hy!我正在使用Laravel 5.8,当我在URL中放置错误的地址时会出现错误
Trying to get property of non-object (View: C:xampphtdocscmsresourcesviewspost.blade.php)
url喜欢
http://127.0.0.1:8000/lkfajds;
这是我放置的错误URL。
为什么这不支持我到404页,我该怎么做
WANT:我想将其重定向到404页
在这里htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
您需要在模型上使用firstorfail((,以便可以向您显示404页。