Laravel-未找到类'App \ Http \ Controllers \ Controller'

时间:2019-09-24 14:14:08

标签: php laravel controller

当我运行命令时:

composer dumpautoload

然后我得到了错误:

 Class 'App\Http\Controllers\Controller' not found

文件app / Http / Controllers / controller.php不存在

可能是什么问题?

1 个答案:

答案 0 :(得分:0)

在最新的6.x版本中,您缺少Laravel随附的控制器

app/Http/Controllers中创建名为Controller.php的新文件

在此粘贴

<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}