123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- #phpinfo();
- #die();
- defined('YII_DEBUG') or define('YII_DEBUG', true);
- ini_set('display_errors','On');
- error_reporting(E_ALL ^ E_NOTICE);
- ini_set('pcre.backtrack_limit', 999999999);
- session_start();
- defined('IN_ADMIN') or define('IN_ADMIN',true);
- setlocale(LC_ALL, 'zh_CN.UTF-8');
- defined('TIMESTAMP') or define('TIMESTAMP',time());//start time of request
- defined('SYS_START_TIME') or define('SYS_START_TIME',microtime());//start time of request
- define('IN_KIIVO', true);//make the file be the only import of the app
- //KIIVOKMS框架目录,如:D:\phpStudy\PHPTutorial\WWW\kiivokms\
- defined('BASE_PATH') or define('BASE_PATH', dirname(dirname(__FILE__).DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR);
- //应用目录,如:D:\phpStudy\PHPTutorial\WWW\kiivokms\web\
- defined('APP_PATH') or define('APP_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
- $config = require __DIR__ . '/../config/config.php';
- include_once __DIR__ . '/../common/functions/global.php';
- include_once __DIR__ . '/../common/functions/dir.php';
- include_once __DIR__ . '/../common/functions/cus.php';
- defined('MYIP') or define('MYIP',ip());
- $domain = require_config('domain.php');
- define('COOKIE_DOMAIN', $domain['cookie_domain']);//定义cookie全局域
- define('WAP_URL', $domain['wap_url']);//WAP站域名
- define('WEB_URL', $domain['web_url']);//PC站域名
- define('API_URL', $domain['api_url']);//接口域名
- define('UPLOAD_DOMAIN', $domain['upload_domain']);//附件域名
- require __DIR__ . '/../vendor/autoload.php';
- require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
- //主机协议
- define('SITE_PROTOCOL', isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://');
- //当前访问的主机名(格式:www.xxx.cn)
- define('SITE_URL', (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''));
- /*****************判断是否手机端***********************/
- if(strpos(WAP_URL,SITE_PROTOCOL.SITE_URL)!==false||check_mobile())
- {
- defined('IN_WAP') or define('IN_WAP',TRUE);
- if(check_baiduapp())
- {
- defined('REQUEST_FROM') or define('REQUEST_FROM',3);
- }
- else if(check_wxapp()){
- defined('REQUEST_FROM') or define('REQUEST_FROM',4);
- }
- else if(check_micromsg())
- {
- defined('REQUEST_FROM') or define('REQUEST_FROM',5);
- }
- else
- {
- defined('REQUEST_FROM') or define('REQUEST_FROM',2);
- }
- defined('APP_URL') or define('APP_URL',WAP_URL);
- }
- else
- {
- defined('IN_WAP') or define('IN_WAP',FALSE);
- defined('REQUEST_FROM') or define('REQUEST_FROM',1);
- defined('APP_URL') or define('APP_URL',WEB_URL);
- }
- defined("DEVICE_TYPE") or define("DEVICE_TYPE",get_device_type());
- $config = array_merge_recursive(require_config('web.php'), $config);
- $params = $config['params'];
- /********************二次定义params结束*****************************************/
- defined('UPLOAD_PATH') or define('UPLOAD_PATH',$config['params']['uploadPath']);
- defined('THUMB_PATH') or define('THUMB_PATH',$config['params']['thumbPath']);
- defined('UPLOAD_URL') or define('UPLOAD_URL',$config['params']['uploadUrl']);
- defined('HTML_PATH') or define('HTML_PATH',$config['params']['htmlPath']);
- defined('CACHE_PATH') or define('CACHE_PATH',$config['params']['cachePath']);
- //定义网页编码
- defined('CHARSET') or define('CHARSET',$config['params']['charSet']);
- //定义时区
- defined('TIME_ZONE') or define('TIME_ZONE',$config['params']['timeZone']);
- //加密因子
- defined('AUTH_KEY') or define('AUTH_KEY',$config['params']['authKey']);
- header("Content-type: text/html; charset=".CHARSET);
- (new yii\web\Application($config))->run();
|