【发布时间】:2015-06-29 05:44:33
【问题描述】:
CakePHP 3.0
对于存在的路线,我收到“缺少路线”错误。
这是我的路线:
#my admin routes...
Router::prefix('admin', function($routes) {
$routes->connect('/', ['controller'=>'Screens', 'action'=>'index']);
$routes->connect('/screens', ['controller'=>'Screens', 'action'=>'index']);
$routes->connect('/screens/index', ['controller'=>'Screens', 'action'=>'index']);
//$routes->fallbacks('InflectedRoute');
});
Router::scope('/', function ($routes) {
$routes->connect('/login', ['controller' => 'Pages', 'action' => 'display', 'login']);
$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
$routes->fallbacks('InflectedRoute');
});
Plugin::routes();
基本上我只是将顶部(用于管理路由)添加到开箱即用的默认路由中。
当我访问/admin/screens/index 时,我看到以下错误:
请注意错误消息:
错误:路由匹配“数组('action' => 'add', 'prefix' => '管理员','插件' => NULL,'控制器' => '屏幕','_ext' => NULL, )" 找不到。
...这很奇怪,因为我没有尝试访问 add 操作。下面打印的参数看起来是正确的。
发生了什么事?
【问题讨论】:
-
呃蛋糕。使用 2.0 时,我遇到了缓存模型的问题。我发现将 debug 设置为 2 可以解决问题。我假设你已经清除了缓存等
-
调试配置似乎发生了一些变化。它现在是一个布尔值,我已将其设置为
TRUE。为了安全起见,我还删除了 tmp/ 中的所有缓存文件,它仍在执行此操作。 -
那会耗尽我的首选。看起来 ndm 有更多有用的见解
标签: php cakephp cakephp-3.0