0

我有一个关于 zend_route 中的正则表达式的问题。我使用这个 XML 代码在 ZendFramework 中创建路由:

<category>
    <type>Zend_Controller_Router_Route_Regex</type>
    <route>c-([a-zA-Z0-9\-\_\+]+)</route>
    <defaults controller="category" action="index" seo_id=""/>
    <map seo_id="1" />
    <reverse>c-%s</reverse>
</category>

我可以转到页面 http://site.com/c-bla-bla_12 但我不能在 URL 中使用加号。例如 http://site.com/c-bla+bla

我怎样才能做到这一点?谢谢。

4

1 回答 1

1

也许 URL 在传递给正则表达式之前被转义。尝试这个 :

<route>c-([a-zA-Z0-9\-\_\+\s]+)</route>
于 2013-06-18T08:42:40.123 回答