php artisan配置中的问题:在Laravel中清除

时间:2018-04-04 07:57:12

标签: laravel laravel-5

我运行php artisan config:clear或php artisan cache:clear或composer dump-autoload但显示此错误:

PHP Fatal error:  Uncaught ReflectionException: Class App\Console\Kernel does not exist in 
vendor/laravel/framework/src/Illuminate/Container/Container.php:767
Stack trace:
#0    
vendor/laravel/framework/src/Illuminate/Container/Container.php(767): ReflectionClass->__construct('App\\Console\\Ker...')
#1    
vendor/laravel/framework/src/Illuminate/Container/Container.php(646): 
Illuminate\Container\Container->build('App\\Console\\Ker...')
#2 
vendor/laravel/framework/src/Illuminate/Container/Container.php(601): 
Illuminate\Container\Container->resolve('App\\Console\\Ker...', Array)
#3      
   vendor/laravel/framework/src/Illuminate/Foundation/Application.php(734):     
Illuminate\Container\Container->make('App\\Console\\Ker...', Array)
#4     
vendor/laravel/framework/src/Illuminate/Container/Container.php(256):     
Illuminate\Foundation\Appl in 
vendor/laravel/framework/src/Illuminate/Container/Container.php on 
line 767

Laravel版本为5.6

我运行php artisan config:clear或php artisan cache:clear或composer dump-autoload。

运行php artisan config后显示此错误:清除

更新1:

My Composer.json文件是这段代码:

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=7.1.3",
    "bogardo/mailgun": "^5.0",
    "cviebrock/eloquent-sluggable": "^4.5",
    "fideloper/proxy": "~4.0",
    "intervention/image": "^2.4",
    "laravel/framework": "5.6.*",
    "laravel/tinker": "~1.0",
    "laravelcollective/html": "^5.6",
    "php-http/guzzle6-adapter": "^1.1",
    "pusher/pusher-php-server": "^3.0",
    "uxweb/sweet-alert": "^1.4"
},
"require-dev": {
    "filp/whoops": "~2.0",
    "nunomaduro/collision": "~1.1",
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "~1.0",
    "phpunit/phpunit": "~7.0",
    "symfony/thanks": "^1.0"
},
"aXutoload": {
    "classmap": [
        "database/seeds",
        "database/factories"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    }
},
"extra": {
    "laravel": {
        "dont-discover": [
        ]
    }
},
"scripts": {
    "post-root-package-install": [
        "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "@php artisan key:generate"
    ],
    "post-autoload-dump": [
        "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
        "@php artisan package:discover"
    ]
},
"config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}

这个文件是我的composer.json。 如何发出这个问题?

4 个答案:

答案 0 :(得分:2)

我遇到同样的问题,要解决此问题,请删除config.php中的文件bootstrap/cache,但如果您运行命令php artisan config:cache,则会再次出现相同的错误

答案 1 :(得分:0)

您的app / Console / Kernel.php文件是否存在?

答案 2 :(得分:0)

从Laravel doc

Laravel ^ 5.5

@php刀片指令

@php Blade指令不再接受内联标签。而是使用指令的完整形式:

With ActiveDocument.Sections(1)
.Headers(wdHeaderFooterPrimary).range.Text = DocName
.Headers(wdHeaderFooterPrimary).range.Font.Name = "Arial"
.Headers(wdHeaderFooterPrimary).range.Font.size = 9
.Footers(wdHeaderFooterPrimary).range.Text = Format(Date, "Long Date") 
.Footers(wdHeaderFooterPrimary).range.Font.Name = "Arial"
.Footers(wdHeaderFooterPrimary).range.Font.size = 9
End With

答案 3 :(得分:0)

重命名bootstrap/cache/config_old.php并重命名routes-v-old.php

我希望你得到你的解决方案。