jan*_*jes 1 routing frameworks zend-framework routes zend-route
我想设置一个类似的路由到标准路由器与可选参数,例如:
intranet.route = 'intranet/:controller/:action/:title/:id'
Run Code Online (Sandbox Code Playgroud)
只有id参数不需要值.我尝试给它一个默认值,如null - 但后来变量仍然设置,但我不希望它存在,当用户没有给它任何值
另外,我如何设置具有动态值的路线,如下所示:
联网/索引/索引/前%20Page/123 /富/酒吧
然后变量$ foo存在,值为"bar"
您可以在application.ini中为参数设置默认值
resources.router.routes.intranet.defaults.id = null
Run Code Online (Sandbox Code Playgroud)
或者如果你想设置一个动态路线,你可以使用*
intranet.route = 'intranet/:controller/:action/:title/*
Run Code Online (Sandbox Code Playgroud)
这使得标题后的变量可选.