在 my 中ReportController.php,我的函数接收Request $request,如下所示:
class ReportController extends Controller{
public function store(Request $request)
{
\Log::info("Request content:");
\Log::info($request);
error_log("request:");
error_log($request);
$insertID = Report::create([
'action' => $request->action,
'reportID' => $request->reportID,
'incidentDate' => $request->incidentDate,
'who' => $request->who,
'location' => $request->location,
'description' => $request->details,
'submittedByName' => $request->submittedByName,
'submittedByMobile' => $request->submittedByMobile,
'submittedByEmail' => $request->submittedByEmail,
'attachments' => $attachments,
'attachmentCount' => $attachmentCount,
'request' => $request
])->id;
}
}
奇怪的是,值的$request变化取决于我转储/存储它们的位置。例如,在我使用 登录的日志文件中\Log::info($request),它显示如下内容:
[2019-05-28 17:35:27] local.INFO: array (
'action' => 'TellUsMore',
'reportID' => 'b19xr211gcbvc',
'incidentDate' => '2019-05-29',
'location' => 'ggg',
'description' => 'gg',
'suggestion' => 'sdfsdf',
'files' =>
array (
0 =>
Illuminate\Http\UploadedFile::__set_state(array(
'test' => false,
'originalName' => 'reports (1).xlsx',
'mimeType' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'error' => 0,
'hashName' => NULL,
)),
1 =>
Illuminate\Http\UploadedFile::__set_state(array(
'test' => false,
'originalName' => 'love your parents - we\'re so busy growing up, we often forget that they\'re growing old.jpg',
'mimeType' => 'image/jpeg',
'error' => 0,
'hashName' => NULL,
)),
),
)
当我将$request值存储在数据库中时也是如此。我打算存储$request在我的 Laravel 日志文件中显示的值,但它保存了$request在我的控制台中显示的值。
我在这里错过了什么?
慕森卡