Php code for init () of zendframework:
/* First, let's take a look at the execution sequence of the class constructor. next we will introduce my code structure; */class Action extends Zend_Controller_Action {} class IndexController extends Action {} class BlogController extends Action {}/* at the beginning I want to use constructors, as shown below: */class Action extends Zend_Controller_Action {public function _ construct () {echo 'test' ;}}/* but an error occurred later. The final cause was that the constructor in Zend_Controller_Action was not called. Read the source code of Zend_Controller_Action and find that the 123 line constructor calls the function $ this-> init (). Therefore, I want to refactor this function in Action so that the init () function can be called every time. Finally: */class Action extends Zend_Controller_Action {public function init () {echo 'test' ;}}/*. every controller will execute this function. This technique is very practical! Finally, we will remind you that during each execution, the internal code of the Controller's initialization function init () is first executed, and then the corresponding code is executed according to the corresponding Action () Selected */