我试图接受一年后在学校开发的laravel项目,我遇到了一些问题。 在托管服务的服务器上传整个项目后,我在浏览器和SSH shell上都出现了这些错误。
致命错误:未捕获的异常' ReflectionException'消息' Class App \ Http \ Kernel不存在'在/home/clients/ffa41f94063541f86a0fe6602a73caa1/myforms/vendor/laravel/framework/src/Illuminate/Container/Container.php:779 堆栈跟踪:#0 /home/clients/ffa41f94063541f86a0fe6602a73caa1/myforms/vendor/laravel/framework/src/Illuminate/Container/Container.php(779):ReflectionClass-> __ construct(' App \ Http \ Kernel&#39 ;)#1 /home/clients/ffa41f94063541f86a0fe6602a73caa1/myforms/vendor/laravel/framework/src/Illuminate/Container/Container.php(659):Illuminate \ Container \ Container-> build(' App \ Http \内核',数组)#2 /home/clients/ffa41f94063541f86a0fe6602a73caa1/myforms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(644):Illuminate \ Container \ Container-> make(&#39) ; App \ Http \ Kernel',Array)#3 /home/clients/ffa41f94063541f86a0fe6602a73caa1/myforms/vendor/laravel/framework/src/Illuminate/Container/Container.php(229):Illuminate \ Foundation \ Application->在/home/clients/ffa41f94063541f86a0fe6602a73caa1/myforms/vendor/laravel/framework/src/Illuminate/Container/Container.php中制作(' App \ Http \ Kernel',数组)#4 / home / clients / ffa41f94063在779号线上
我认为它可能与我的命名空间配置有关,因为我还没有完全理解。
这是我的composer.json文件:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "5.*",
"barryvdh/laravel-dompdf": "0.5.*",
"guzzlehttp/guzzle": "~4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "myforms/app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}

我已经做过的事情:
composer install
composer dump-autoload
composer update
顺便说一句,我在插入composer update
如果我要发布另一个可能有用的文件,请通知我。
提前感谢您的帮助。
答案 0 :(得分:11)
在composer.json中更改:
` .page-wrapper {
min-height: 100vh;
position: relative;
}
footer {
background-color: #f0f;
position: absolute;
bottom: 0;
width: 100%
}
.longer {
height: 50px;
background-color: #ddd;
}`
为:
"psr-4": {
"App\\": "myforms/app/"
}
在服务器上的源目录中,运行 "psr-4": {
"App\\": "app/"
}
,然后composer update
Laravel中的PSR-4查找相对于项目根目录的命名空间
答案 1 :(得分:0)
在我的情况下,composer.json缺少右括号“ {}”,并且“ psr-4”所在的行位于错误的json段中。
好
答案 2 :(得分:0)
检查console/kernel.php
是否在app
文件夹内,如果不是,则可能在您的laravelApp
文件夹内。
如果是,请将console/kernel.php
移至app
文件夹。
答案 3 :(得分:-1)
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "5.*",
"barryvdh/laravel-dompdf": "0.5.*",
"guzzlehttp/guzzle": "~4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "myforms/app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}