英文:
Cakephp 3 Missing Route issue
问题
我正在处理CakePHP 3的Web应用程序,其中根路由'/'不起作用。我已经查看了与此问题相关的几个问题,但问题仍未解决。
下面是config/routes.php文件的配置
use Cake\Core\Plugin;
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;
use Cake\ORM\TableRegistry;
Router::defaultRouteClass(DashedRoute::class);
Router::scope("/", function (RouteBuilder $routes) {
$routes->connect('/', ['controller' => 'users', 'action' => 'login']);
$routes->fallbacks(DashedRoute::class);
});
Plugin::routes();
英文:
I am working on CakePHP 3 web application in which routes are not working for root '/'. I have gone through several questions related to this issue but the issue is not resolved.
Below is the configuration of config/routes.php file
use Cake\Core\Plugin;
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;
use Cake\ORM\TableRegistry;
Router::defaultRouteClass(DashedRoute::class);
Router::scope("/", function (RouteBuilder $routes) {
$routes->connect('/', ['controller' => 'users', 'action' => 'login']);
$routes->fallbacks(DashedRoute::class);
});
Plugin::routes();
It looks like the root '/' route defined in routes.php is not loading, I have checked the path of routes.php which is included in "/vendor/cakephp/cakephp/src/Routing/Router.php" is correct.
What may be incorrect here?
答案1
得分: 0
我找到解决方案,删除“myapp_cake_model_route”缓存文件在tmp/cache中解决了这个问题,现在路由正在加载。
英文:
I found the solution, deleting "myapp_cake_model_route" cache file in tmp/cache resolved this issue and now routes are loading
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论