English 中文(简体)
是否有办法将浏览器从Zentd Framework的boot锁中转移?
原标题:
  • 时间:2009-05-29 14:45:52
  •  标签:

I need to redirect according to some conditions in the bootstrap file.
It is done AFTER the front controller and routes are defined.
How do I do that?
(I know I can simply use header( Location: ....) The point is I need to use the Router to build the URL.

最佳回答

more than year later, i m programming in ZF and I got this solution for your problem. Here is my function in bootstrap that determines where the user is logged on.

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap

页: 1

protected $_front;

(...)

protected function _initViewController() 
页: 1
    (...)

    $this->bootstrap( FrontController );
    $this->_front = $this->getResource( FrontController );

    (...)
iii

protected function _initLogado()
页: 1
    $router = $this->_front->getRouter();
    $req = new Zend_Controller_Request_Http();
    $router->route($req);
    $module = $req->getModuleName();

    $auth = Zend_Auth::getInstance();
    if ($auth->hasIdentity()) 页: 1
        $this->_view->logado = (array) $auth->getIdentity();
    iii else 页: 1
        $this->_view->logado = NULL;
        if ($module ==  admin ) 页: 1
            $response = new Zend_Controller_Response_Http();
            $response->setRedirect( / );
            $this->_front->setResponse($response);
        iii
    iii
iii

iii

问题回答

重新定位实际上不应放在boot陷室档案中...... 这将是一个可怕的夜晚,为军士们打着 de,几年来,军士们最终.着你的手法。

要么使用前主计长Plugin, 行动主计长Plugin,要么在你的行动主计长中使用。 最终应完全避免这种转移。

我愿从前线控制器中挑选出路人,将其打上<条码>(>方法,然后使用<条码>标题():

关于

Rob...

您可以检查假肢中“旋转”方法的条件,然后使用thi-&;行动主计长->_helper->redirector()转方向;





相关问题
热门标签