示例#1
0
 static function controller()
 {
     $value = Classes::get_config('module_host');
     if ($value == 1) {
         $all = DB::all('host');
         if (!$all) {
             return;
         }
         foreach ($all as $v) {
             $url = $v['url'];
             $redirect = $v['redirect'];
             $arr[$url] = $redirect;
         }
         $host = Str::new_replace(host(), array('http://' => '', 'https://' => ''));
         if ($arr[$host]) {
             redirect("http://" . $arr[$host] . $_SERVER['REQUEST_URI']);
         }
     }
 }
示例#2
0
 public function actionIndex()
 {
     $value = Classes::get_config($this->config_key);
     $rt = \app\core\Pagination::run('\\app\\modules\\host\\models\\Host', array('orderBy' => 'sort desc,id desc'), array('pageSize' => 50));
     echo $this->render('index', array('models' => $rt->models, 'pages' => $rt->pages, 'value' => $value));
 }