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

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

WBOY
WBOYOriginal
2016-06-06 20:31:491079browse

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

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

回复内容:

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

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

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

<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>
Statement:
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