0

我正在尝试路由所有段,但也有例外。所以我想路由:除了(home|about|contact)之外的任何路径。类似的东西。

我已经设法在 codeigniter 中做到了这一点,但在 Zend Framework 中我遇到了更多困难。在 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>
4

1 回答 1

0

根据 zfded 的评论添加答案,

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

应该是正确的路线。

于 2011-12-24T11:42:55.083 回答