繁体   English   中英

Laravel 6:尚未设置外观根

[英]Laravel 6 : A facade root has not been set

我已将我的网站从 Laravel 5.8 迁移到 Laravel 6,在 Composer更新后,我在网站上出现此错误,并且仅使用一个命令php artisan

PHP Fatal error:  Uncaught RuntimeException: A facade root has not been set. in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:242
Stack trace:
#0 /var/www/html/app/Exceptions/Handler.php(48): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(376): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(141): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 /var/www/html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 {main}
  thrown in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 242

Fatal error: Uncaught RuntimeException: A facade root has not been set. in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:242
Stack trace:
#0 /var/www/html/app/Exceptions/Handler.php(48): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(376): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(141): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 /var/www/html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 {main}
  thrown in /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 242 

我采用了一个新的 Laravel 6 文件config\\app.php和一个新的.env但总是这个错误......

我该如何解决?

我知道,答案有点晚了 :) 但我仍然相信它可以帮助遇到此问题的其他人。

Str::slug()替换所有str_slug()方法解决了这个问题。 就我而言,我在config/cache.phpconfig/session.php文件中找到了旧助手。

最后我找到了一个解决方案,我复制了一个 Laravel 6 配置文件: config/session.php并且它的工作原理。

让我们尝试一下:

导航至bootstrap / app.php。 取消注释以下行(注释通常是//,将其删除)。

$app->withFacades();

所以代替

//$app->withFacades();

这将是

$app->withFacades();

我收到了这些错误 - 我自己的错 - 我正在将我的 Laravel 应用程序文件移动到一个子目录中,看起来像app.php以及我的/config/目录中缺少其他一些文件:

cache.php
cors.php
filesystems.php
hashing.php
logging.php
mail.php
services.php
session.php
view.php

应该:

app.php
auth.php
broadcasting.php
cache.php
cors.php
database.php
filesystems.php
hashing.php
logging.php
mail.php
queue.php
services.php
session.php
view.php

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM