_normalizeClassName($class_name); $path = $this->_classFilePath($this->_reflection_module->moduleDir(), $class_name, '_controller.php'); $this->_logClean(); if (file_exists($path)) { throw new Q_ClassFileExistsException($class_name, $path); } // 创建控制器文件 $data = array( 'class_name' => $class_name, 'namespace' => $namespace, ); $content = $this->_parseTemplate('controller', $data); $this->_createFile($path, $content); // 建立视图目录 $dir = rtrim($this->_reflection_module->moduleDir(), '/\\') . '/view'; if ($namespace) { $dir .= "/{$namespace}"; } $this->_createDirs($dir . '/_layouts'); $this->_createDirs($dir . "/{$controller_name}"); return $this; } }