在我的Bootstrap中
$route = new Zend_Controller_Router_Route(
':language/:country/:controller/:action/*',
array(
'language' => 'en',
'country' => 'us',
'controller' => 'bicycle',
'action' => 'index'
),
array(
'language' => '[a-z][a-z]',
'country' => '[a-z][a-z]'
)
);
我认为某处
echo $this->url(array('page'=>2));
//actually this translated to $route->assemble(array('page' => 2), null, false);
问题是当我有一些GET参数时:在构建链接时不会考虑它们,而这正是我真正想要的。
例:
我访问URL(在浏览器中)
http://localhost/myproject/en/us/controller/action/?get1=gval1&get2=gval2&get3=gval3
组合的URL是
http://localhost/myproject/en/us/controller/action/page/2
代替
http://localhost/myproject/en/us/controller/action/page/2/get1/gval1/get2/gval2/get3/gval3/
或(我希望下一个)
http://localhost/myproject/en/us/controller/action/page/2/?get1=gval1&get2=gval2&get3=gval3
有任何想法吗?
最佳答案
当然,一种解决方案(使用Apache)在我看来是这样的:
$this->url(array(page=>2)) . ($_SERVER['QUERY_STRING']?$_SERVER['QUERY_STRING']:"")
但您不能确定此变量将始终包含在$ _SERVER变量中。
关于zend-framework - Zend Framework:路由组装和GET参数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10641231/