/** * 载入请求模板. * * 不存在模板文件或指定模板将返回一个空数组. * * @param string $module 模块名 * @param string $action 行为名 * @param string $templateName 模板名 * * @return array */ public static function loadTemplate($module, $action, $templateName) { if (!is_string($module) || !is_string($action) || !is_string($templateName)) { return array(); } if (($templates = self::loadCache($module, $action)) === false) { $filepath = Config::path("template/{$module}/") . $action . '.php'; if (!file_exists($filepath)) { return array(); } $templates = (require $filepath); if (!is_array($templates)) { return array(); } self::preserveCache($module, $action, $templates); } if (array_key_exists($templateName, $templates)) { return $templates[$templateName]; } return array(); }