我正在使用 Laravel 设置 API。当我输入不存在的路线时,我会被重定向到显示 404 | 的视图。未找到。
我怎样才能改变这个观点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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)