Home  >  Article  >  Backend Development  >  Exception in registered routing under the Controllers folder of the lumen framework

Exception in registered routing under the Controllers folder of the lumen framework

WBOY
WBOYOriginal
2016-09-24 09:15:131380browse

1.lumen Controllers structure

<code>    Controllers
         --Test
             --TestController.php
         </code>

2. Register route

<code>$app->get("test",'Test\TestController@est');
</code>

3.lumen reports an error;

<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:

<code>    <?php
</code>

namespace AppHttpControllersTest;

use AppHttpControllersController as Controller;

class TestController extends Controller
{

<code>public function test(){
        echo 1132;
}</code>

}
?>

This code can be output normally under Controllers, but it is abnormal under the ControllersTest folder

lumen version 5.2.9

Reply content:

1.lumen Controllers structure

<code>    Controllers
         --Test
             --TestController.php
         </code>

2. Register route

<code>$app->get("test",'Test\TestController@est');
</code>

3.lumen reports an error;

<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:

<code>    <?php
</code>

namespace AppHttpControllersTest;

use AppHttpControllersController as Controller;

class TestController extends Controller
{

<code>public function test(){
        echo 1132;
}</code>

}
?>

This code can be output normally under Controllers, but it is abnormal under the ControllersTest folder

lumen version 5.2.9

It seems that the AppHttpControllersTestTestController class cannot be found. The route definition is correct. It should be a class loading problem.

You try running php artisan tinker, and then run $foo = new AppHttpControllersTestTestController; in the shell to see if you can find this class.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn