CakePHP 3: Missing route error for route that exists

后端 未结 2 797
离开以前
离开以前 2020-12-16 19:28

CakePHP 3.0

I\'m getting a \"Missing Route\" error for a route that exists.

Here are my routes:

#my admin routes...
Router::prefix(\'admin\'         


        
2条回答
  •  失恋的感觉
    2020-12-16 19:52

    This work for me in case of use prefix admin :-

    Router::prefix('admin', function ($routes) {
        // Because you are in the admin scope,
        // you do not need to include the /admin prefix
        // or the admin route element.
        $routes->connect('/', ['controller' => 'Users', 'action' => 'index']);
        $routes->extensions(['json', 'xml']);
        // All routes here will be prefixed with `/admin`
        $routes->connect('/admin', ['controller' => 'Order', 'action' => 'index']);
        // And have the prefix => admin route element added.
        $routes->fallbacks(DashedRoute::class);
    }); 
    

提交回复
热议问题