Home > Backend Development > PHP Tutorial > 如何在phalcon的路由中使用regex修饰符

如何在phalcon的路由中使用regex修饰符

WBOY
Release: 2016-06-06 20:31:49
Original
1078 people have browsed it

<code>$router->add('/([0-9\x{4e00}-\x{9fa5}]+)');
</code>
Copy after login
Copy after login

像这种不使用分隔符的正则表达式如何使用修饰符?

回复内容:

<code>$router->add('/([0-9\x{4e00}-\x{9fa5}]+)');
</code>
Copy after login
Copy after login

像这种不使用分隔符的正则表达式如何使用修饰符?

不知道你路由具体想如何配置,可参考:

<code>php</code><code>$router->add('/archive/([0-9]{4})/([0-9]{2})/([0-9]{2})', array(
    'namespace'     => 'Controller\Site',
    'controller'    => 'archive',
    'action'        => 'index',
    'year'          => 1,
    'month'         => 2,
    'day'           => 3
));

$router->add('/archive/blog.html', array(
    'namespace'     => 'Controller\Site',
    'controller'    => 'archive',
    'action'        => 'blog',
));

......
</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template