/* 根據訪問域名動態訪問 */ //防止惡意訪問,以及進行簡單的權限管理 $hostArr = array( 'mc.test.com' => array('/down/index','/down/test'), 'md.test.com' => array('/reg/index','/reg/down'), ); $root = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST']; $hostFlag = false; if(isset($hostArr[$_SERVER['HTTP_HOST']])){ if(!in_array($_SERVER['QUERY_STRING'],$hostArr[$_SERVER['HTTP_HOST']])){ exit('No direct script access allowed'); } $hostFlag = true; $root .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); } /* 根據訪問域名動態訪問 */ $config['base_url'] = $hostFlag ? $root : 'http://m.test.com/';