我正在为Laravel 4.1应用程序构建一个管理页面,并希望能够轻松访问日志文件。
我试过了:
Route::get('logs', function() {
$logfile = storage_path() . '/logs/laravel.log';
$logs = file_get_contents($logfile);
return Response::json(array('logs' => $logs));
});
但它会引发以下错误:
{"error":{"type":"UnexpectedValueException","message":"The Response content must be a string or object implementing __toString(), \"boolean\" given.","file":"\/var\/www\/html\/myApp\/vendor\/symfony\/http-foundation\/Symfony\/Component\/HttpFoundation\/Response.php","line":421}}