zendframework2中变相实现自定义的controller的继承

在入口文件index.php中进行实例化

$fc = Zend_Controller_Front::getInstance();//取得Zend_Controller_Front类实例

$fc -> registerPlugin(new ClassName());


<?php
require_once 'Zend/Controller/Plugin/Abstract.php';
class ClassName extends Zend_Controller_Plugin_Abstract
{
    
/**
     * 重写父类的preDispatch方法
     * 
     * @param Zend_Controller_Request_Abstract $request
     */
    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {

}
}

你可能感兴趣的:(继承,controller,zendframework)