$t_r) { return 1; } elseif($t_l == $t_r) { return 0; } else { return -1; } } class index_tab { private static $stInstance = null; private $mTabs; const mb_home_tab_id = 123; public function __construct() { $this->mTabs = []; } public static function instance() { if(self::$stInstance == null) { self::$stInstance = new index_tab(); } return self::$stInstance; } public function tabs() { if(StatesHelper::fetch_state('tags')) { $this->init(); } return $this->mTabs; } private function init() { Log::record("init tags data.",Log::INFO); $this->mTabs = []; $mod_webcode = Model('web_code'); $tabs = $mod_webcode->get_cache(self::mb_home_tab_id); if($tabs == null || empty($tabs)) { $tabs[] = ['special_id' => 0,'name' => '首页', 'sort' => 0]; } uasort($tabs,'comp_tab'); foreach ($tabs as $key => $val) { $this->mTabs[] = ['special_id' => $val['special_id'],'name' => $val['name']]; } } }