duandu1377 2018-10-02 22:19
浏览 6
已采纳

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 ?

  • 写回答

1条回答 默认 最新

  • duanqizao6492 2018-10-02 22:39
    关注

    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?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。