您好,我有一个网站,如果登录会话超时,我会像这样保存请求
Abc::saveThisUrl($this->getRequest());
public static function saveThisUrl($url) {
$lastPg = new Zend_Session_Namespace('history');
$lastPg->url = $url;
}
然后成功登录后我想执行它
public static function getSavedUrl() {
$lastPg = new Zend_Session_Namespace('history');
if(!empty($lastPg->url)) {
$path = $lastPg->url;
$lastPg->unsetAll();
return $path;
}
return ''; // Go back to index/index by default;
}
所以在我的AbcController.php
public loginAction()
{
...//login succesfull
//i tried
$request = Abc::getSavedUrl(); /* @var $request Zend_Controller_Request_Abstract */
$this->setRequest($request);
$this->dispatch($request);
//or
$this->run($request->getRequestUri());
//also tried
$front = Zend_Controller_Front::getInstance();
$front->setRequest($request);
return $front->dispatch($request);
}
两者都没有工作。我也需要能够执行POST 查询,互联网上的许多解决方案只关心 URL