Tag Archives: ZendFramework

ZF controller init method

[cc lang="php" tab_size="2" lines="40"]public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
$this->setRequest($request)
->setResponse($response)
->_setInvokeArgs($invokeArgs);
$this->_helper = new Zend_Controller_Action_HelperBroker($this);
$this->init();
}[/cc]
在zf 每個 controller 中
可以用function init 這個去代替__constructor (不知道這樣形容 恰不恰當)
Whenever Zend Framework instantiates a controller, the base Zend Framework class (in our case Zend_Controller_Action) has a lot of important code in the __construct() method.  It is possible to override the __construct() in [...]

Posted in ZendFramework | Tagged | Leave a comment