updateConfig(); return true; } /** * 更新插件配置 */ protected function updateConfig() { $full_config = get_addon_fullconfig('wwh'); $config = get_addon_config('wwh'); $updateConfig = include ADDON_PATH . 'wwh' . DS . 'updateConfig.php'; foreach ($updateConfig as $v) { $found = false; // 查找是否已存在同名配置项 foreach ($full_config as &$item) { if ($item['name'] == $v['name']) { // 如果是rewrite或__tips__配置则完全替换 if (in_array($v['name'], ['rewrite', '__tips__'])) { $item['value'] = $v['value']; } $found = true; break; } } // 如果不存在则添加新配置 if (!$found) { array_push($full_config, $v); } } set_addon_fullconfig('wwh', $full_config); } /** * 应用初始化 */ public function appInit() { include_once ADDON_PATH . 'wwh' . DS . 'common.php'; } }