我在学习laravel的同时学习了一个教程,但目前我遇到了这个错误
致命错误:未捕获ReflectionException:/var/www/html/cms/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
中不存在类App \ Http \ Kernel
app / Http / Kernel.php中的类确实存在。
这些是文件的权限
-rw-rw-r-- 1 ivan www-data 1537 nov 26 2016 Kernel.php
这些是对整个目录文件的权限
-rw-rw-r-- 1 ivan www-data 567 nov 26 2016 server.php
-rw-rw-r-- 1 ivan www-data 1918 nov 26 2016 readme.md
-rw-rw-r-- 1 ivan www-data 1026 nov 26 2016 phpunit.xml
-rw-rw-r-- 1 ivan www-data 212 nov 26 2016 package.json
-rw-rw-r-- 1 ivan www-data 503 nov 26 2016 gulpfile.js
-rw-rw-r-- 1 ivan www-data 1395 nov 26 2016 composer.json
-rw-rw-r-- 1 ivan www-data 1646 nov 26 2016 artisan
drwxr-x--- 2 ivan www-data 4096 jan 19 20:06 tests
drwxrwxrwx 5 ivan www-data 4096 jan 19 20:06 storage
drwxr-x--- 5 ivan www-data 4096 jan 19 20:06 resources
drwxr-x--- 7 ivan www-data 4096 jan 19 20:06 public
drwxr-x--- 5 ivan www-data 4096 jan 19 20:06 database
drwxr-x--- 11 ivan www-data 4096 jan 19 20:06 app
-rw-rw-r-- 1 ivan www-data 127324 jun 2 15:27 composer.lock
drwxr-x--- 2 ivan www-data 4096 jun 2 15:29 config
drwxr-x--- 3 ivan www-data 4096 jun 2 15:44 bootstrap
drwxr-xr-x 33 ivan www-data 4096 jun 2 15:48 vendor
当我在终端php artisan serve
中运行并尝试在http://localhost:8000
网站上加载网站时,该网站正在运行。
这里有什么问题?
Kernel.php
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
....
更新:来自console /
的Kernel.php<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
更新:composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"graham-campbell/markdown": "^6.1",
"laravelcollective/html": "5.2",
"intervention/image": "^2.3"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
更新
>>> new App\Http\Kernel()
TypeError: Argument 1 passed to Illuminate\Foundation\Http\Kernel::__construct() must implement interface Illuminate\Contracts\Foundation\Application, none given on line 1
>>> App\Http\Kernel()
PHP Fatal error: Call to undefined function App\Http\Kernel() in eval()'d code on line 1