我怎样才能获得一个url params以及zend php框架的重定向url? 假设我在当前页面上有以下网址
localhost/business/microsoft
当用户点击该页面上的按钮时,它会将它们重定向到具有以下URL的另一个页面
localhost/comment/WavvLdfdP6g8aZTtbBQHTw?return_url=%2Fbusiness%2FWavvLdfdP6g8aZTtbBQHTw
我怎么能写bootstrap getRouter所以它可以捕获上面的url参数?目前看来效果不佳
$router->addRoute('comment', new Zend_Controller_Router_Route_Regex(
'business/comment/id=',
array(
'controller' => 'business',
'action' => 'comment'
)
, array(
'id' => '\d+'
)
));
感谢!!!
答案 0 :(得分:0)
您需要编写一个plugin来捕获请求参数( preDispatch())或发送后( postDispatch()),具体取决于您是否可能想要拦截和重定向请求。
//basic example of controller plugin
class MyPlugin extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
return $this->getRequest->getParams();
}
}