Laravel的控制器

Laravel的控制器

问题描述:

I trying to learn Laravel but I have a problem that I don't understand. I get an error message when I want to run the controller.

I enter 3 lines of command on CMD

php artisan make:controller WelcomeController
php artisan make:controller AboutController
php artisan serve

Then, I establish the link between the controller and the route.

Route::get('about', 'AboutController@index');

And in the file AboutController.php I have

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AboutController extends Controller
{
    public function index()

    {

        return view('about');

    }
}

Normally it should work ? I looked a tuto on youtube https://www.youtube.com/watch?v=QASe8bXMMFA&t=56s

I have as error message => "include(C:\wamp64\www\testprojet\vendor\composer/../../app/Http/Controllers/Controller.php): failed to open stream: No such file or directory"

Do you have an idea please ?

Your error indicates that the Controller.php that your AboutController extends.

Is there a Controller.php file in C:\wamp64\www\testprojet\app\Http\Controllers?

I suspect there isn't, and if needed you can create it using the current Controller.php file in the Laravel repository.

I'm unsure why this is the case, but suspect it may be due to a step being missing when setting your project up... What steps did you follow to get Laravel up and running for your project?