0
我想在CakePHP中實現自定義路由。我下面的文檔如何在CakePHP中使用自定義路由?
http://book.cakephp.org/2.0/en/development/routing.html#custom-route-classes
在app/Routing/Route
<?php
App::uses('CakeRoute', 'lib/Cake/Routing/Route');
class CategoryRoute extends CakeRoute
{
public function parse($url)
{
$params = parent::parse($url);
if (empty($params)) {
return false;
}
return true;
}
}
app/Config/routes.php
App::uses('CategoryRoute', 'Routing/Route');
Router::connect('/mypage/*', array('controller' => 'mycontroller', 'action' => 'view'), ['routeClass' => 'CategoryRoute']);
,但我得到
Missing Controller
Error: Controller could not be found.
Error: Create the class Controller below in file: app/Controller/Controller.php
我的自定義路由210
當我刪除['routeClass' => 'CategoryRoute']
時,重新路由功能正常。
非常感謝您的先生!沒有在文檔中找到。 –