//Zend_Controller_Front 多模块配置分析 /** * 多模块配置目录方法 迭代器 * @param $path */ public function addModuleDirectory($path) { try { $dir = new DirectoryIterator($path); } catch (Exception $e) { require_once 'Zend/Controller/Exception.php'; throw new Zend_Controller_Exception("Directory $path not readable", 0, $e); } foreach ($dir as $file) { if ($file->isDot() || ! $file->isDir()) { continue; } $module = $file->getFilename(); // Don't use SCCS directories as modules if (preg_match('/^[^a-z]/i', $module) || ('CVS' == $module)) { continue; } $moduleDir = $file->getPathname() . DIRECTORY_SEPARATOR . 'controllers'; $this->addControllerDirectory($moduleDir, $module); } return $this; } /** * 添加单个模块 结合addModuleDirectory * @param $directory * @param $module */ public function addControllerDirectory($directory, $module = null) { $this->getDispatcher()->addControllerDirectory($directory, $module); return $this; }