douyi3767 2017-12-04 09:10 采纳率: 0%
浏览 4082

如何解决致命错误:找不到类'App \ Http \ Controllers \ Controller'

我正在尝试使用Laravel 5.4将表单提交到数据库,但是每次我按下“提交”按钮时,都会出现以下错误消息:

Fatal error: Class 'App\Http\Controllers\Controller' not found.

下面是我的代码controller.php:

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;

class PagesController extends Controller
{
    public function index()
    {
        return view('./');
    }

    public function about()
    {
        $title='About us';
        return view('pages.about')->with('title',$title);
    }

    public function services()
    {
        $data=array(
            'title'=>'Services',
            'services'=>['Mechanic help','book a mechanic','others']
        );
        return view('pages.services')->with ($data);
    }

    public function create()
    {

    }
}
  • 写回答

2条回答 默认 最新

  • duanjia2772 2017-12-04 09:19
    关注

    That kind of error would mean that you are either missing your Controller.php file in the same folder, or the autoloader isn't loading it, or it is not defining the class Controller. This is the file in the Laravel repo:

    https://github.com/laravel-shift/laravel-5.4/blob/master/app/Http/Controllers/Controller.php

    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler