gpt4 book ai didi

laravel - 查看404错误页面

转载 作者:行者123 更新时间:2023-12-03 09:03:16 24 4
gpt4 key购买 nike

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com