laravel - 查看404错误页面

标签 laravel error-handling

我有一个 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/

相关文章:

php - Laravel 返回 View 不发送数据,但回显 View 有效

php - Laravel:如何访问 AppServiceProvider 中的 session 值?

c++ - 修复链接错误

r - R-将向量/矩阵作为行添加到另一个数据帧

c++ - Qt异常处理——try catch

r - R中的“Too few positive probabilities”错误

dependency-injection - Laravel 4 : Facade vs DI (when to use)

php - 如果我在使用 Mysql 的 Laravel 中使用 Query Builder 而不是 Eloquent ORM,模型仍然有用吗?

php - 如何从 Laravel Controller 写入控制台?

asp.net - 如何在ext.net的组合框中动态显示错误消息