【发布时间】:2021-01-03 02:56:12
【问题描述】:
我的应用后端突然停止工作,返回 500 HTTP 错误,并在 laravel.log 中出现此错误:
[2020-09-16 12:28:15] local.ERROR: Uncaught Error: Class 'Illuminate\Http\Response' not found in /home/.../vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:424
[2020-09-16 12:28:19] local.ERROR: Class 'Illuminate\Http\Response' not found {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Class 'Illuminate\\Http\\Response' not found at /home/../vendor/laravel/framework/src/Illuminate/Routing/Router.php:751)
Laravel 版本是 5.8.37
有谁知道哪里出了问题?
我已经尝试过 chmod -R 777 storage/、php artisan cache:clear、php artisan config:clear 和 composer dump-autoload,都没有成功。
提前谢谢你!
编辑:删除供应商文件夹并运行以下命令修复了问题,但是我注意到在 composer dump-autoload 期间出现了一些错误。
composer install
以下是出现的错误:
Deprecation Notice: Class Twilio\TwiML\Voice\Echo_ located in ./vendor/twilio/sdk/src/Twilio/TwiML/Voice/Echo.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class ConsoleTVs\Support\Traits\StringFUnctions located in ./vendor/consoletvs/support/Traits/StringFunctions.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\Http\Controllers\BonusCardController located in ./app/Http/Controllers/Api/V1/BonusCardController.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\UserPartner located in ./app/Models/UserPartner.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class App\UserMarathon located in ./app/Models/UserMarathon.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
谢谢!
【问题讨论】:
-
你能证明一段代码正是导致这个错误的原因吗?
-
问题是我没有更改我的控制器中的任何内容,并且错误日志显示问题出在 /vendor/ 中,而不是在我的控制器中。知道发生了什么吗?
-
你能不能运行 composer dump-autoload,或者这可能是旧错误
-
@MuhammadTariq 他们说他们已经跑过了
-
您可以删除供应商文件夹并运行
composer install。也许它会工作。
标签: php laravel composer-php