当我从网站网址中删除一些宪章时,它会显示“ ErrorException试图获取非对象的属性”
我需要重定向到404页面。我在handler.php中编写以下代码
public function render($request, Exception $exception){
if($this->isHttpException($exception)){
switch ($exception->getStatusCode()){
// not found
case 404:
return redirect()->guest('/');
break;
// internal error
case '500':
return redirect()->guest('/');
break;
default:
return $this->renderHttpException($exception);
break;
}
}else{
return parent::render($request, $exception);
}
}