php artisan 任何命令 都报错!!!

执行任何laravel的命令 (php artisan 任何东西)都会报错,但是!页面能正常运行

报错:

PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 2 passed to Illuminate\Routing\UrlGenerator::construct() must be an instance of Illuminate\Http\Request, null given, called in /data/wwwroot/bbs/g9zz/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 60 in /data/wwwroot/bbs/g9zz/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:103 Stack trace: #0 /data/wwwroot/bbs/g9zz/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(60): Illuminate\Routing\UrlGenerator->construct(Object(Illuminate\Routing\RouteCollection), NULL) #1 /data/wwwroot/bbs/g9zz/vendor/laravel/framework/src/Illuminate/Container/Container.php(290): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing{closure}(Object(Illuminate\Foundation\Application)) #2 /data/wwwroot/bbs/g9zz/vendor/laravel/framework/src/Illuminate/Container/Container.php(746): Illuminate\Container\Container->Illuminate\Container{closure}(Object(Illuminate\Foun in /data/wwwroot/bbs/g9zz/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 103

url 什么东西的问题!

原来我在 我的config/某个.php 某个配置文件里 我写了一个

    '3' => [
        'name' => '叶落',
        'url' =>  url('list','ylsc')
    ],

直接写死的一个配置.... 这个url报错了!

所以解决办法是:

    '2' => [
        'name' => '视频',
        'url' => PHP_SAPI === 'cli' ? false : url('list','video')
    ],
    '3' => [
        'name' => '叶落',
        'url' => PHP_SAPI === 'cli' ? false : url('list','ylsc')
    ],

记得加上PHP_SAPI === 'cli' ? false :

恩!然后执行php artisan 任何程序 就成功啦!


欢迎转载,但请附上原文地址哦,尊重原创,谢谢大家 本文地址: http://www.iphpt.com/detail/77/

当你能力不能满足你的野心的时候,你就该沉下心来学习