我正在使用 Laravel 设置 API。当我输入不存在的路线时,我会被重定向到显示 404 | 的 View 。未找到。
如何将此 View 更改为 abort( response()->json('Not Found', 404));
以便尝试通过其他应用程序访问 API 的人获得JSON 响应显示未找到。
最佳答案
You may publish Laravel's error page templates using the vendor:publish Artisan command. Once the templates have been published, you may customize them to your liking:
php artisan vendor:publish --tag=laravel-errors
关于php - 如何更改 Laravel 中 404 未找到 View 上的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59771191/