php - Laravel 错误声明 App\Exceptions\Handler::report(Throwable $exception)

标签 php laravel

关闭。这个问题需要debugging details .它目前不接受答案。












想改进这个问题?将问题更新为 on-topic对于堆栈溢出。

2年前关闭。




Improve this question




我正在使用 Laravel 6 并在部署到运行 PHP 7.3 的共享主机时出现以下错误:

App\Exceptions\Handler::report(Throwable $exception)

Declaration of App\Exceptions\Handler::report(Throwable $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Exception $e) in /home/kb2hm3y8r4wm/public_html/laravel.supremeanimation.com/app/Exceptions/Handler.php on line 8

最佳答案

我认为你得到的错误是由于 Laravel 7(不是 6)的变化,你可以在 Laravel 7 upgrade guide 上看到。 .检查这个:

  • 对于 Laravel < 7:

    The report and render methods of your application's App\Exceptions\Handler class should accept instances of the Exception interface instead of Throwable instances:



    use Exception;
    
    public function report(Exception $exception);
    public function render($request, Exception $exception);
    
  • 对于 Laravel >= 7:

    The report and render methods of your application's App\Exceptions\Handler class should accept instances of the Throwable interface instead of Exception instances:



    use Throwable;
    
    public function report(Throwable $exception);
    public function render($request, Throwable $exception);
    
  • 关于php - Laravel 错误声明 App\Exceptions\Handler::report(Throwable $exception),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60670862/

    相关文章:

    php - 将字符串添加到表中现有值的更短方法

    php - 一段时间后使php session 变量过期

    php - Laravel 原始查询和 Eloquent ORM 关系

    laravel - 如何以 PDF 形式提供从 laravel Storage::disk ('private' )->get($file) 返回的数据

    php - 外键为空时如何从连接中拉出行

    php - 在第 1 行的 '06:09:43 WHERE Book_id = 19 AND Date_issued = 2017-03-29 17:28:34' 附近使用 SQL 语法时出错

    php - MySQL JOIN 一个表或另一个表

    php - Laravel:从请求中检索绑定(bind)模型

    angularjs - 如何使用 Laravel API 在 AngularJS 表单中发送 csrf_token()?

    mysql - 如何查询 Eloquent ORM 多对多关系