public static function init() { self::$config = iPHP::config(); iURL::init(self::$config['router']); define('iCMS_DIR', self::$config['router']['DIR']); define('iCMS_URL', self::$config['router']['URL']); define('iCMS_PUBLIC_URL', self::$config['router']['public_url']); define('iCMS_FS_URL', self::$config['FS']['url']); define('iCMS_REWRITE', iPHP_ROUTER_REWRITE); define('iCMS_API', iCMS_PUBLIC_URL . '/api.php'); define('iCMS_UI', iCMS_DIR . 'app/ui/common'); define('iCMS_UI_URL', iCMS_URL . '/app/ui/common'); define('iCMS_API_URL', iCMS_API . '?app='); self::assign_site(); }
private static function config() { $site = iPHP_MULTI_SITE ? $_SERVER['HTTP_HOST'] : iPHP_APP; if (iPHP_MULTI_DOMAIN) { //只绑定主域 preg_match("/[^\\.\\/][\\w\\-]+\\.[^\\.\\/]+\$/", $site, $matches); $site = $matches[0]; } iPHP_MULTI_SITE && define('iPHP_APP_SITE', $site); strpos($site, '..') === false or exit('<h1>What are you doing?(code:001)</h1>'); //config.php 中开启iPHP_APP_CONF后 此处设置无效, define('iPHP_APP_CONF', iPHP_CONF_DIR . '/' . $site); //网站配置目录 define('iPHP_APP_CONFIG', iPHP_APP_CONF . '/config.php'); //网站配置文件 @is_file(iPHP_APP_CONFIG) or exit('<h1>' . iPHP_APP . ' 运行出错.找不到"' . $site . '"网站的配置文件!(code:002)</h1>'); $config = (require iPHP_APP_CONFIG); //config.php 中开启后 此处设置无效 defined('iPHP_DEBUG') or define('iPHP_DEBUG', $config['debug']['php']); //程序调试模式 defined('iPHP_TPL_DEBUG') or define('iPHP_TPL_DEBUG', $config['debug']['tpl']); //模板调试 defined('iPHP_SQL_DEBUG') or define('iPHP_SQL_DEBUG', $config['debug']['sql']); //模板调试 defined('iPHP_TIME_CORRECT') or define('iPHP_TIME_CORRECT', $config['time']['cvtime']); defined('iPHP_APP_SITE') && ($config['cache']['prefix'] = iPHP_APP_SITE); //config.php --END-- define('iPHP_URL_404', $config['router']['404']); //404定义 ini_set('display_errors', 'OFF'); error_reporting(0); if (iPHP_DEBUG || iPHP_TPL_DEBUG) { ini_set('display_errors', 'ON'); error_reporting(E_ALL & ~E_NOTICE); } $timezone = $config['time']['zone']; $timezone or $timezone = 'Asia/Shanghai'; //设置中国时区 @ini_set('date.timezone', $timezone); function_exists('date_default_timezone_set') && @date_default_timezone_set($timezone); self::multiple_device($config); self::$config = $config; }