Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex cakephp路由不允许文件扩展名_Regex_Cakephp_Routes_Cakephp 1.3 - Fatal编程技术网

Regex cakephp路由不允许文件扩展名

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('/*

我需要一个cakephp路由,它将捕获所有的URL,如果在以前的不包含文件扩展名的路由中不匹配的话

下面是当前的路线

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也将如此,我希望它能帮助您