mirror of https://gitee.com/karson/fastadmin.git
绑定站点的二级域名、外部域名
parent
c2793f1fb2
commit
8bc0b5e06b
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @desc: 动态绑定二级域名
|
||||||
|
* @Author: Dr.Xing <ezfwork@foxmail.com>
|
||||||
|
* @Since: 2018/1/28 15:18
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace seven\behavior;
|
||||||
|
|
||||||
|
use think\Route;
|
||||||
|
use think\Cache;
|
||||||
|
|
||||||
|
class BindDomain
|
||||||
|
{
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$rules = Cache::get('rules');
|
||||||
|
if(!$rules) {
|
||||||
|
$rules = \app\common\model\Sites::refreshRulesCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($rules as $k => $v){
|
||||||
|
Route::domain($v['s'], 'index'. $v['p']);
|
||||||
|
Route::domain('admin.'.$v['s'], 'admin'. $v['p']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue