Zend路由器使用正则表达式


Zend router with regex

我试图路由所有段,但也有例外。所以我要路由:any except (home|about|contact)。差不多吧

我已经设法在codeigniter中做到这一点,但我在Zend框架中遇到了更多的困难。在codeigniter中,我会在我的configs/routes.php文件中写这行:

$route['^(?!home|about|contact)'S*'] = "category";

这是我在zend项目的routes.xml中的内容。

    <category>
            <type>Zend_Controller_Router_Route_Regex</type>
        <route>(?!home|about|contact)</route>
        <defaults>
            <controller>category</controller>
            <action>index</action>
        </defaults>
        <reverse>%s</reverse>
    </category>

根据zfded的评论添加答案,

<route>(^(?!home|about|contact)'S*)</route>

应该是正确的路由