ReflectionException类App \ Http \ Controllers \ PostsController不存在Lumen 5.5

问题描述:

I am new to Lumen, and I got error when using Postman: ReflectionException Class App\Http\Controllers\PostsController does not exist

Here is my PostsController.php

namespace App\Http\Controller;

use App\Post;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class PostsController extends Controller{
/*content*/
}

I already checked location of my controller. I also read the same problem and tried the solutions, but it was not work for me. Can anyone tell me how to fix this? Thanks before

我是Lumen的新手,使用Postman时遇到错误: ReflectionException Class App \ Http \ Controllers \ PostsController不存在 code> p>

这是我的 PostsController.php code> p>

 命名空间App \  Http \ Controller; 
 
use App \ Post; 
use App \ Http \ Controllers \ Controller; 
use Illuminate \ Http \ Request; 
 
class PostsController扩展Controller {
 / * content * / 
} 
   code>  pre> 
 
 

我已经检查了控制器的位置。 我也读了同样的问题并尝试了解决方案,但它对我来说不起作用。 谁能告诉我如何解决这个问题? 谢谢 p> div>

Controller's namespace is wrong, Check the namespace. Good luck

namespace App\Http\Controllers;

You have wrong namespace in your controller file.

You need to change it to Controllers

namespace App\Http\Controllers;