Cakephp 3 缺失路由问题

huangapple go评论134阅读模式
英文:

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.

Cakephp 3 缺失路由问题

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?

Cakephp 3 缺失路由问题

答案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

huangapple
  • 本文由 发表于 2023年3月12日 16:01:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75711772.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定