Regex cakephp路由不允许文件扩展名
我需要一个cakephp路由,它将捕获所有的URL,如果在以前的不包含文件扩展名的路由中不匹配的话 下面是当前的路线Regex cakephp路由不允许文件扩展名,regex,cakephp,routes,cakephp-1.3,Regex,Cakephp,Routes,Cakephp 1.3,我需要一个cakephp路由,它将捕获所有的URL,如果在以前的不包含文件扩展名的路由中不匹配的话 下面是当前的路线 Router::connect('/*', array('controller' => 'frontend', 'action' => 'display',null)); 我需要将上述路由修改为不捕获所有具有文件扩展名的URL我不太理解您的要求,但您可以这样做: Router::parseExtensions('html'); Router::connect('/*
Router::connect('/*', array('controller' => 'frontend', 'action' => 'display',null));
我需要将上述路由修改为不捕获所有具有文件扩展名的URL我不太理解您的要求,但您可以这样做:
Router::parseExtensions('html');
Router::connect('/*/:title', array('controller' => 'frontend', 'action' => 'display',null),
array(
'pass' => array('title')
)
);
链接:
$html->link('Title', array('controller' => 'frontend', 'action' => 'display', 'title' => Inflector::slug('text to slug', '-'), 'ext' => 'html'))
我希望这对你有帮助。祝你好运我在基于CakePHP 1.2的应用程序中为动态生成的图像添加了如下扩展:
Router::connect('/postImage/*', array('controller' => 'posts','action' => 'postImage', 'url' => array('ext' => 'png')));
上述代码使以下两个url均可访问:
和
我认为CakePHP1.3也将如此,我希望它能帮助您