<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                現在是移動端的天下,域名的意義其實并不大了,并且啟用頻道二級域名還容易存在JS跨域的問題,同時微信公眾號與小程序也會有域名的限制,所以一直以來就沒有考慮在系統中集成頻道二級域名。 大家有需要的話,可以參考下面的方法自行配置。 修改文件`\application\config.php` 查找`url_domain_deploy`把他右邊的 `false`換成 `true` 再查找 `url_domain_root` 在他右邊輸入 `abc.com` 即你的域名(注意單引號不能漏掉)這一項其實不設置也問題不大,但有的服務器不設置就不會生效,所以盡量設置一下吧。 如下圖所示 ![](https://img.kancloud.cn/83/18/8318875ed01e9fcd4c6965cf1ab9d424_672x566.png) 再查找 `extra_file_list`把右邊中括號里邊的內容`THINK_PATH . 'helper' . EXT`換成 `APP_PATH . 'helper' . EXT,THINK_PATH . 'helper' . EXT` 如下圖所示 ![](https://img.kancloud.cn/c6/1e/c61e841c662235446333a881c625fb3a_1146x213.png) 接著在`\application\`目錄下創建一個`helper.php`文件 即`\application\helper.php`里邊的內容放下如下代碼 ~~~ <?php use think\Url; if (!function_exists('url')) { /** * Url生成 * @param string $url 路由地址 * @param string|array $vars 變量 * @param bool|string $suffix 生成的URL后綴 * @param bool|string $domain 域名 * @return string */ function url($url = '', $vars = '', $suffix = true, $domain = false) { static $array = null; if ($array===null) { $array = @include(RUNTIME_PATH.'url_cfg.php'); if (empty($array)) { $array = []; } } if ($vars && is_string($vars)) { parse_str($vars,$vars); } $par = ''; $_vars = $vars; //避免改變順序 if ($vars) { ksort($vars); $par = http_build_query($vars); } if ($domain===false) { $url = full_url($url); list($m_name,$m_file,$m_action) = explode('/', $url); $md = modules_config($m_name); if(IN_WAP===true){ if ($md['wap_domain']) { $domain = $md['wap_domain']; } }else{ if ($md['pc_domain']) { $domain = $md['pc_domain']; } } if ($domain===false) { if(IN_WAP===true && config('webdb.wap_domain')){ $domain = config('webdb.wap_domain'); }elseif(config('webdb.pc_domain')){ $domain = config('webdb.pc_domain'); } } } if ($par && $array[$url][$par]) { $_url = Url::build($url.'?'.$par, [], $suffix, $domain); }else{ $_url = Url::build($url, $_vars, $suffix, $domain); } if ( ($m_name=='index'&&!in_array($m_file, ['alonepage','index','login','reg','plugin']))|| ($m_name=='member'&&!in_array($m_file, ['index'])) ) { //避免ajax或框架的跨域 $_url = preg_replace("/^(http|https):\/\/([^\/]+)\//i", "/",$_url); }elseif($url=='index/index/index'){ $_url = str_replace('index/index/index.html','',$_url); } return $_url; } } ~~~ 然后再修改 `\application\route.php` 查找里邊類似的代碼 ~~~ Route::group(['name'=>'bbs','ext'=>'html','__domain__'=>'thinkphp'], [ 'show-<id>' =>['bbs/content/show',['method'=>'get'],['id' => '\d+']], 'list-<fid>'=>['bbs/content/index',['method'=>'get'],['fid' => '\d+']], 'mid-<mid>'=>['bbs/content/index',['method'=>'get'],['mid' => '\d+']], 'show' => 'bbs/content/show', 'list' => 'bbs/content/index', 'index$' => 'bbs/index/index', ]); ~~~ 把他刪除,換成下面的代碼 ~~~ Route::domain('bbs',[ 'show-<id>' =>['bbs/content/show',['method'=>'get'],['id' => '\d+']], 'list-<fid>'=>['bbs/content/index',['method'=>'get'],['fid' => '\d+']], 'mid-<mid>'=>['bbs/content/index',['method'=>'get'],['mid' => '\d+']], 'show' => 'bbs/content/show', 'list' => 'bbs/content/index', 'index$' => 'bbs/index/index', '/$' => 'bbs/index/index', ]); ~~~ 第一行的`bbs`即代表二級域名是`bbs`,比如bbs.xxx.com 這個bbs是可以換成其它的,比如`lutan` 下面7行的`bbs`即代表是論壇模塊目錄名 上面只是針對論壇的二級域名設置,其它頻道比如cms qun也同樣的方法這樣處理,先要刪除原有的路由規則,再添加,不然的話,會有沖突不會生效。 如下圖所示 ![](https://img.kancloud.cn/88/7f/887ffc798dbff2f04754edd2f950b096_1491x807.png) 再修改文件`\application\admin\controller\Module.php` 查找 `['icon','icon', '圖標', ''],`在他下面一行添加如下代碼 `['text','pc_domain', '二級域名', '沒配置好服務器的話,必須留空,否則請輸入二級域名比如“bbs”而不是http://bbs.xxx.com也不是bbs.xxx.com'],` 保存即可,如下圖所示 ![](https://img.kancloud.cn/6f/e4/6fe403be11d770d6a8f41c73ef5eb305_1613x526.png) 最后就要升級一下數據庫,在后臺數據庫管理那里導入下面的內容 ~~~ ALTER TABLE `qb_module` ADD `pc_domain` VARCHAR( 100 ) NOT NULL COMMENT '二級域名,比如“wap”而不是http://wap.xxx.com也不是wap.xxx.com'; INSERT INTO `qb_config` (`id`, `type`, `title`, `c_key`, `c_value`, `form_type`, `options`, `ifsys`, `htmlcode`, `c_descrip`, `list`, `sys_id`) VALUES(0, 1, 'PC訪問專用域名', 'pc_domain', '', 'text', '', 1, '', '沒配置好服務器的話,必須留空,否則請輸入域名比如“www”而不是http://www.xxx.com也不是www.xxx.com', 0, 0); ~~~ 確認先把要使用的二級域名指向到當前網站的根目錄后。再進后臺設置一下www域名網址,及相應的頻道二級域名即可,如下圖所示 ![](https://img.kancloud.cn/75/e2/75e2ec4c47fdf00d072db8a063e0a338_1451x764.png) ![](https://img.kancloud.cn/27/ec/27ecaed8fccb5313f82bbab29b08d3fa_1436x760.png) 這樣就可以使用頻道二級目錄了! 必須要注意一下 ![](https://img.kancloud.cn/c9/7e/c97e74f5abf6f9753b4f5a1429e01d2f_1813x922.png) 最后的效果如下圖所示 ![](https://img.kancloud.cn/81/bc/81bc5bc41841f026ead40ee5527dec7e_930x677.gif)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看