laravel 5自定义404 [英] laravel 5 custom 404
问题描述
这让我发疯.我正在使用Laravel 5,看来4.2版的文档和生成404页的文档不起作用.
This is driving me crazy. I'm working with Laravel 5 and it appears that the docs for 4.2 and generating 404 pages does not work.
首先,没有global.php,所以我尝试将以下内容放入route.php:
First, there is no global.php so I tried putting the following in routes.php:
App::missing(function($exception)
{
return Response::view('errors.missing', array(), 404);
});
这会导致错误找不到方法缺少()"
This results in an error "method missing() not found"
Debug设置为false.
Debug is set to false.
我已经搜索过,但是到目前为止,还没有找到有关在Laravel 5中设置404页面的信息.
I've searched and searched but so far have found no information on setting 404 pages in Laravel 5. Would appreciate any help.
推荐答案
转到资源/视图/错误,并在404页面上创建带有所需内容的404.blade.php文件,Laravel负责其余的工作.
Go to resources/views/errors and create a 404.blade.php file with what you want on your 404 page and Laravel takes care of the rest.
这篇关于laravel 5自定义404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!