我正在尝试将一些数组记录到laravel.log文件中,我试图这样做:
Log::info('Post: ' . $postSlug . ' with the post ID: ' . $postID .
print_r($linkMatches[0], TRUE));
但是,没有记录任何内容,但如果我dd($linkMatches[0]);
,那么我会返回一个数组:
array:1 [
0 => "'https://hivnorge.no/Se-hva-vi-gjoer/Underartikler/Positive-women'"
]
为什么我在执行dd时会返回一个数组,但是无法将其记录到laravel.log文件中?
更新
出于某种原因,它突然开始工作,没有更改代码或其他任何内容,但现在它记录了所有内容。
答案 0 :(得分:-1)
我认为问题是print_r标记,在文档Laravel Log doc
中Log::info('User failed to login.', ['id' => $user->id]);
而不是追加print_r,你可以将它作为param传递来解决你的问题