我正在尝试路由所有段,但也有例外。所以我想路由:除了(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>