在 my 中ReportController.php,我的函數(shù)接收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變化取決于我轉(zhuǎn)儲/存儲它們的位置。例如,在我使用 登錄的日志文件中\(zhòng)Log::info($request),它顯示如下內(nèi)容:[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, )), ),) 當(dāng)我將$request值存儲在數(shù)據(jù)庫中時也是如此。我打算存儲$request在我的 Laravel 日志文件中顯示的值,但它保存了$request在我的控制臺中顯示的值。我在這里錯過了什么?
1 回答

慕森卡
TA貢獻(xiàn)1806條經(jīng)驗 獲得超8個贊
error_log()
call $request->__toString()
,您的 Log 類var_export()
出于某種原因調(diào)用。這就是區(qū)別;)
- 1 回答
- 0 關(guān)注
- 181 瀏覽
添加回答
舉報
0/150
提交
取消