<?php /** * Front插件 获取包含models *@author wolf [Email: 116311316@qq.com] *@param $modulesList 模块的路径 */ class Custom_Plugin_Loader extends Zend_Controller_Plugin_Abstract { protected $_moduleName; /** *在分发循环(dispatch loop)前被调用 */ public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { $this->_moduleName = $request->getModuleName (); //取得模块名 unset($this->_request); unset($this->_response); if (! isset ( $this->_moduleName )) { throw new Exception ( "Module does not exist!" ); } set_include_path ( implode ( PATH_SEPARATOR, array ( //realpath:符号链接和相对路径引用转换为相应的绝对路径 realpath ( APPLICATION_PATH . '/' . $this->_moduleName . '/models' ), get_include_path () ) ) ); } } //end class