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>
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>
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 AppHttpControllersTestTestController;
看看你能不能找到這個類別。