/** * @param string $theme_name */ public function themeChangeHandle($theme_name = 'NovaGreenStudio') { if (get_kv('home_theme') == $theme_name) { $this->error('无需切换'); } S('theme_config', null); $res = set_kv('home_theme', $theme_name); set_kv($theme_name . '_theme_config', null); if ($res) { $cache_control = new SystemEvent(); $cache_control->clearCacheAll(); $this->success('切换成功'); } else { $this->error('切换失败'); } }
/** * */ protected function saveKv() { S('kv_array', null); //清空缓存 foreach ($_POST as $key => $value) { set_kv($key, $value); } }
/** * @param string $theme_name */ public function themeChangeHandle($theme_name = 'NovaGreenStudio') { if (get_kv('home_theme') == $theme_name) { $this->error('无需切换'); } if ($this->themeStatus($theme_name) == 'disabled') { $this->error('请先启用主题'); } $res = set_kv('home_theme', $theme_name); if ($res) { $cache_control = new SystemEvent(); $cache_control->clearCacheAll(); $this->success('切换成功'); } else { $this->error('切换失败'); } }