我的问题是,每当出现403错误时,我应该重定向到我自己的自定义页面或显示flash消息(在同一个页面上),比如that.How,我可以在Laravel中实现吗?
发布于 2017-08-14 20:37:07
您可以使用app/Exceptions/Handler.php来完成此操作
public function render($request, Exception $e)
{
if ($e->getStatusCode() == 403) {
return redirect('yourpage'); // this will be on a 403 exception
}
return parent::render($request, $e); // all the other exceptions
}发布于 2017-08-14 20:31:39
发布于 2017-08-14 20:46:23
you can make you own page in inside the view .resources/views/errors/yourblade.blade.php在此之后,只需将页面返回到该页面。
https://stackoverflow.com/questions/45674520
复制相似问题