我在APP_DEBUG=true文件中有.env:
APP_ENV=local
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://test.dev我故意使用了不正确的url (例如:test.dev/asdsadsa),它不在web.php路由文件中。
当路由不存在时,我希望得到一个laravel调试错误。
Sorry, the page you are looking for could not be found.
NotFoundHttpException in RouteCollection.php line 161:但是,它仍然显示404错误页面(views/ error /404.blade.php),甚至APP_DEBUG也被设置为true。
我试过的是:
为了确保laravel能够读取.env文件,我甚至进行了测试:
Route::get('/', function() {
dd(env('APP_DEBUG'));
});返回true
2- php artisan config:cache没有修复它。
3- chmod -R 777 storage没有修复它。
发布于 2016-10-22 18:13:08
如果您在views/errors中有404个错误页面,它将被显示,如果没有,NotFoundHttpException将被显示。
发布于 2021-01-26 16:02:19
我在这里玩得很晚了,但是如果没有其他的工作,试着清除所有的缓存,然后运行:
php手工优化:clear
发布于 2017-02-04 12:22:00
只需在错误视图中添加这两行,例如在views\errors\404.blade.php中
<?php $e = new Symfony\Component\Debug\ExceptionHandler(); ?>
<?php echo getenv('APP_DEBUG') == 'true' ? $e->getContent(Symfony\Component\Debug\Exception\FlattenException::create($exception)) : ''; ?>这将显示自定义404错误页中的laravel调试错误。
https://stackoverflow.com/questions/40193995
复制相似问题