开发者

CakePHP Router::connect and regex

开发者 https://www.devze.com 2023-03-01 09:39 出处:网络
I\'m having some trouble with redirection in config/routes.php file I can\'t find the right regex $_skill = \'[A-Za-z\\-]+\'

I'm having some trouble with redirection in config/routes.php file

I can't find the right regex

$_skill = '[A-Za-z\-]+'

Router::connect('/-:skill/:city-:zipcode:shit', array('controller' => 'redirects', 'action' => 'district'),
                    array('city' => '[A-Za-z-0-9\]+.(er|eme)-arrondissement',
                          'skill' => $_skill,
                          'zipcode' => $_zipcode,
                          'shit' => '开发者_Go百科(.*)',
                          'pass' => array('zipcode'),
                          )
                    );

I would like to match any url where city ends with 'arrondissement' but i'm a total noob in regex

thank you.


With most regex you can use the dollar symbol to match the end of a string.

simply 'arrondissement$'

And drop all the stuff at the beginning.

0

精彩评论

暂无评论...
验证码 换一张
取 消