开发者

Zend router with regex

I'm trying to route all segment but also have exceptions. So I want to route :any except (home|about|contact). Something like that.

I've manage to do this in codeigniter but I'm having a little more difficulties in Zend Framework. In codeigniter I would write this line in my configs/routes.php file:

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

This 开发者_Go百科is what I have in my routes.xml for my zend project.

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


Adding the answer based on zfded's comment,

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

should be the correct route.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜