我有一个 Controller 来检测是否有可用的内容。如果没有,我希望用户得到一个错误页面。目前,我使用:
if(!$translation) {
App::abort(404);
}
我不知道如何设置404错误页面的样式。该 View 文件在哪里,或者该如何进行?
最佳答案
Customize the error page for 404 HTTP status codes, create a
resources/views/errors/404.blade.php
. This file will be served on all 404 errors generated by your application. The views within this directory should be named to match the HTTP status code they correspond to. The HttpException instance raised by the abort function will be passed to the view as an $exception variable.
参见Laravel Documentation on Custom Http Error Pages
关于laravel - 查看404错误页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40892774/