Laravel控制器:Illuminate \ Contracts \ Container \ BindingResolutionException目标类[AccountController]不存在

问题描述

此错误最可能的原因是什么

Illuminate \ Contracts \ Container \ BindingResolutionException

目标类[AccountController]不存在
http://127.0.0.1:8000/

这是我的 web.php 文件

<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get("/","AccountController@index");

这是我的 AccountController.php 文件

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AccountController extends Controller
{
    public function index(){
        /* $people = [
            ['name' => 'John Doe','age' => 20],['name' => 'Jane Doe','age' => 10]
        ]; */
        return view('account');
    }
}

我还有 account.blade.php 作为我的查看文件

我使用命令-php artisan make:Controller AccountController-

创建了控制器文件

运行php artisan route:list时出现以下错误

 Illuminate\Contracts\Container\BindingResolutionException 

  Target class [AccountController] does not exist.

  at E:\...\vendor\laravel\framework\src\Illuminate\Container\Container.php:811
    807▕
    808▕         try {
    809▕             $reflector = new ReflectionClass($concrete);
    810▕         } catch (ReflectionException $e) {
  ➜ 811▕             throw new BindingResolutionException("Target class [$concrete] does not exist.",$e);
    812▕         }
    813▕
    814▕         // If the type is not instantiable,the developer is attempting to resolve
    815▕         // an abstract type such as an Interface or Abstract Class and there is

  1   [internal]:0
      Illuminate\Foundation\Console\RouteListCommand::Illuminate\Foundation\Console\{closure}(Object(Illuminate\Routing\Route))

  2   E:\...\vendor\laravel\framework\src\Illuminate\Container\Container.php:809
      ReflectionException::("Class AccountController does not exist")

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...