1.lumen Controllers结构
<code> Controllers --Test --TestController.php </code>
2.注册路由
<code>$app->get("test",'Test\TestController@est'); </code>
3.lumen报错;
<code> lumen.ERROR: ReflectionException: Class App\Http\Controllers\Test\TestController does not exist in /Users/shumingjian/Desktop/www/lumen/vendor/illuminate/container/Container.php:734 </code>
4.Testcontroller代码:
<code> <?php </code></code>
namespace AppHttpControllersTest;
use AppHttpControllersController as Controller;
class TestController extends Controller
{
<code>public function test(){ echo 1132; }</code>
}
?>
该代码在Controllers下可以正常输出,但在ControllersTest文件夹下异常
lumen 版本 5.2.9
1.lumen Controllers结构
<code> Controllers --Test --TestController.php </code>
2.注册路由
<code>$app->get("test",'Test\TestController@est'); </code>
3.lumen报错;
<code> lumen.ERROR: ReflectionException: Class App\Http\Controllers\Test\TestController does not exist in /Users/shumingjian/Desktop/www/lumen/vendor/illuminate/container/Container.php:734 </code>
4.Testcontroller代码:
<code> <?php </code></code>
namespace AppHttpControllersTest;
use AppHttpControllersController as Controller;
class TestController extends Controller
{
<code>public function test(){ echo 1132; }</code>
}
?>
该代码在Controllers下可以正常输出,但在ControllersTest文件夹下异常
lumen 版本 5.2.9
看起来是找不到 AppHttpControllersTestTestController 这个类,路由定义是没错的,应该是类加载的问题。
你试着运行 php artisan tinker,然后在 shell 里运行 $foo = new App\Http\Controllers\Test\TestController;
看看能不能找到这个类。