laravel 5異常錯誤:FatalErrorException in Handler.php line 38的解決
前言
本文主要給大家介紹了關(guān)于laravel5異常錯誤FatalErrorException in Handler.php line 38的解決,分享出來供大家參考學(xué)習(xí),話不多說了,來一起看看詳細(xì)的介紹。
1、錯誤提示
FatalErrorException in Handler.php line 38:
Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in D:\www\activity\vendor\compiled.php on line 1817 and defined in D:\www\activity\app\Exceptions\Handler.php:38
Stack trace:
#0 D:\www\activity\vendor\compiled.php(1817): App\Exceptions\Handler->report(Object(Error))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error))
#2 {main}
thrown
原因:D:wwwactivityvendorcompiled.php on line 1817 的變量$e不是Exception的實例對象(對錯誤提示的翻譯……^.^笑cry)
2、解決方案
在提示的錯誤地方加上變量$e的實例判斷,如果不是Exception類型,就new一個
if (!$e instanceof \Exception) {
$e = new FatalThrowableError($e);
}
new完之后的樣子:
public function handleException($e)
{
if (!$e instanceof \Exception) {
$e = new FatalThrowableError($e);
}
$this->getExceptionHandler()->report($e);
if ($this->app->runningInConsole()) {
$this->renderForConsole($e);
} else {
$this->renderHttpResponse($e);
}
}
總結(jié)
以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。
相關(guān)文章
php導(dǎo)出csv數(shù)據(jù)在瀏覽器中輸出提供下載或保存到文件的示例
這篇文章主要介紹了php導(dǎo)出csv數(shù)據(jù)在瀏覽器中輸出提供下載或保存到文件的示例,需要的朋友可以參考下2014-04-04
PHP導(dǎo)出數(shù)據(jù)超時的優(yōu)化建議
當(dāng)數(shù)據(jù)訪問次數(shù)過多時,建議使用redis緩存一些固定數(shù)據(jù),減少mysql查詢次數(shù)。今天小編給大家分享PHP導(dǎo)出數(shù)據(jù)超時的優(yōu)化建議,感興趣的朋友一起看看吧2021-07-07
php從數(shù)據(jù)庫讀取數(shù)據(jù),并以json格式返回數(shù)據(jù)的方法
今天小編就為大家分享一篇php從數(shù)據(jù)庫讀取數(shù)據(jù),并以json格式返回數(shù)據(jù)的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-08-08

