本文介绍了如何在Laravel中的404找不到视图上更改文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Laravel设置API.当我输入一条不存在的路由时,我将被重定向到一个显示404 | 404的视图.未找到.
I'm setting up an API with Laravel. When I enter a route that does not exist I get redirected to a view that says 404 | Not found.
我如何将该视图更改为 abort(response()-> json('Not Found',404));
,以便尝试通过另一个应用程序访问API的人获得表示未找到的JSON响应.
How could I change this view to abort( response()->json('Not Found', 404));
so that the person that tries to access the API via another application get a JSON response saying Not Found.
推荐答案
php artisan vendor:publish --tag=laravel-errors
这篇关于如何在Laravel中的404找不到视图上更改文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!