Cakephp路由规则,如.htaccess
我想删除和清理一下我的代码 我在.htaccess中有此规则Cakephp路由规则,如.htaccess,php,.htaccess,cakephp,Php,.htaccess,Cakephp,我想删除和清理一下我的代码 我在.htaccess中有此规则 RewriteRule ^(.+),(.+),(.+),([0-9]+).php$ /hotels/description/$4/3 RewriteRule ^(.+)+(.+)-([0-9]+).php$ /hotels/description/$3/4 RewriteRule ^([0-9]+).php.*$ /hotels/description/$1/1 RewriteRule ^([0-9]+).ht
RewriteRule ^(.+),(.+),(.+),([0-9]+).php$ /hotels/description/$4/3
RewriteRule ^(.+)+(.+)-([0-9]+).php$ /hotels/description/$3/4
RewriteRule ^([0-9]+).php.*$ /hotels/description/$1/1
RewriteRule ^([0-9]+).htm.*$ /hotels/description/$1/2
我想利用这一点,制定cakephp路由规则
我需要这样的东西:
Router::connect('/:descId',
array('controler' => 'hotels', 'action' => 'description'),
array(
'descId' => '[0-9]+'
),
array('pass'=>array('descId'))
);
可悲的是,这根本不起作用。它正在寻找控制器。原因验证[0-9]不起作用
Missing Controller
Error: 18182.phpController could not be found.
Error: Create the class 18182.phpController below in file: app\controllers\18182.php_controller.php
<?php
class 18182.phpController extends AppController {
var $name = '18182.php';
}
?>
问题是我何时会为链接制定另一个规则,如:
domain.com/Country、Region、Hotel、Number.php
有人能帮我写这些规则吗?事实上我现在自己写的,但是谢谢你的帮助。cakebook中有错误的例子,所以我被它弄错了。我的工作示例:Router::connect('/:gid.php',array('controller'=>'hotels','action'=>'description'),array('gid'=>'[0-9]+','pass'=>array('gid'));
Router::connect('/:descId',
array('controller' => 'hotels', 'action' => 'description'),
array(
'pass' => array('descId'),
'descId' => '[0-9]+',
));
Router::connect('/:descId',
array('controller' => 'hotels', 'action' => 'description'),
array(
'pass' => array('descId'),
'descId' => '[0-9]+',
));