search

Home  >  Q&A  >  body text

Laravel development uses Artisan to create a controller and reports an error. Please help!

Yesterday I used the php artisan controller:make PostController command to create the controller, then deleted it and re-created it several times, no problem.

I got an error when I tried to create PostController today.

{"error":

    {"type":"ReflectionException","message":"Class PostController does not exist",
     "file":"D:\wamp\www\laravel\vendor\laravel\framework\src\Illuminate\Routing\ControllerInspector.php","line":28}

}

Then I found that changing to another controller or even another artisan command reported the same error. Do not you know why?

It is suspected that the problem was caused by repeated operations yesterday. Trying to execute composer dump-autoload and composer clear still did not solve the problem. . . And only this project has problems, other projects are normal. What is the reason for this? Please help!

怪我咯怪我咯2824 days ago522

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 16:58:49

    It may be that there is an error in the artisan file. Copy it from another project and try it.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 16:58:49

    This problem is that you first defined a controller that does not exist in the routing, just remove it.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 16:58:49

    php artisan make:controller PostController, your command is wrong

    reply
    0
  • Cancelreply