{"id":416,"title":"laravel\u8bbf\u95ee\u4e0d\u5b58\u5728\u7684\u8def\u7531\u65f6\u81ea\u5b9a\u4e49\u9519\u8bef\u9875\u9762","good":0,"bad":0,"hit":2507,"created_at":"2019-01-16 11:55:21","content":"
\u6709\u65f6\u5019\u7f51\u7ad9\u6846\u67b6\u4e4b\u7c7b\u7684\u63db\u4e86\uff0c\u5bfc\u81f4\u8def\u7531\u4e5f\u53d8\u4e86\uff0c\u4ee5\u524d\u7684\u94fe\u63a5\u88ab\u641c\u7d22\u6536\u5f55\u7684\uff0c\u7528\u6237\u8bbf\u95ee\u540e\u627e\u4e0d\u5230\u4e86\uff0c\u635f\u5931\u6d41\u91cf\uff1b
<\/p>
\u5728laravel\u4e2d\u53ef\u4ee5\u4fee\u6539app\\Exceptions\\Handle.php\u7684render\u65b9\u6cd5\uff1a<\/p>
public function render($request, Exception $exception)<\/p>
{<\/p>
\/\/404<\/strong><\/p> if ($exception->getCode() == 0) {<\/strong><\/p> return response()->view('home.error.404');<\/strong><\/p> }<\/strong><\/p> return parent::render($request, $exception);<\/p> }<\/p> \u81ea\u5b9a\u4e49\u4e00\u4e2a404\u6a21\u677f\uff0c\u4f8b\u5982\uff1a<\/p> <!doctype html><\/p> <html><\/p> <head><\/p> <meta http-equiv="Content-Type" content="text\/html; charset=utf-8"\/><\/p> <script language="javascript"><\/p> window.location.href = '\/';<\/p> <\/script><\/p> <\/head><\/p> <body><\/p> <p style="text-align:center;padding:300px;"><\/p>
<\/p>