Пример #1
0
 /**
  * 应用程序初始化
  * @access public
  * @return void
  */
 public static function start()
 {
     // 设定错误和异常处理
     register_shutdown_function(array('Think', 'fatalError'));
     set_error_handler(array('Think', 'appError'));
     set_exception_handler(array('Think', 'appException'));
     // 注册AUTOLOAD方法
     spl_autoload_register(array('Think', 'autoload'));
     //[RUNTIME]
     Think::buildApp();
     // 预编译项目
     //[/RUNTIME]
     // 运行应用
     $_SERVER['ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
     $cdn_ips = array('182.140.245.*', '58.49.105.*', '61.147.103.*', '61.147.79.*', '61.158.240.*', '61.244.110.*', '210.209.122.*', '64.32.4.*', '69.28.51.*', '111.161.72.*', '112.253.3.*', '112.64.18.*', '113.31.80.*', '113.31.82.*', '117.34.91.*', '118.144.86.*', '119.97.153.*', '120.197.85.*', '121.11.83.*', '121.12.119.*', '121.14.212.*', '122.200.77.*', '122.225.36.*', '123.129.209.*', '123.150.187.*', '124.95.164.*', '182.118.12.*', '182.118.38.*', '183.232.29.*', '202.102.85.*', '202.105.176.*', '203.171.228.*', '220.181.135.*', '223.202.2.*', '211.155.80.*', '61.164.211.*');
     foreach ($cdn_ips as $cdnip) {
         if ($_SERVER['ip'] == $cdnip || strrchr($cdnip, '.') == '.*' && ($pre = substr($cdnip, 0, -2)) && $pre == substr($_SERVER['ip'], 0, strlen($pre))) {
             $realip = $_SERVER['HTTP_X_FORWARDED_FOR'];
             empty($realip) && ($realip = $_SERVER['HTTP_CLIENT_IP']);
             if (preg_match('#^\\d+(\\.\\d+){3}$#', $realip)) {
                 $_SERVER['REMOTE_ADDR'] = long2ip(ip2long($realip));
             }
         }
     }
     App::run();
     return;
 }
Пример #2
0
 /**
  * 应用程序初始化
  * @access public
  * @return void
  */
 static public function start() {
     // 设定错误和异常处理
     register_shutdown_function(array('Think','fatalError'));
     set_error_handler(array('Think','appError'));
     set_exception_handler(array('Think','appException'));
     // 注册AUTOLOAD方法
     spl_autoload_register(array('Think', 'autoload'));
     //[RUNTIME]
     Think::buildApp();         // 预编译项目
     //[/RUNTIME]
     // 运行应用
     App::run();
     return ;
 }
Пример #3
0
 /**
 +----------------------------------------------------------
 * 应用程序初始化
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 public static function start()
 {
     // 设定错误和异常处理
     // [saebuilder] 去掉错误接管
     // set_error_handler(array('Think','appError'));
     // set_exception_handler(array('Think','appException'));
     // 注册AUTOLOAD方法
     spl_autoload_register(array('Think', 'autoload'));
     //[RUNTIME]
     Think::buildApp();
     // 预编译项目
     //[/RUNTIME]
     //编译模版
     self::buildTemplateCache();
     return;
 }