Ejemplo n.º 1
0
Archivo: App.php Proyecto: xtzlyp/newpi
 public function __construct()
 {
     //设置主环境
     ini_set('date.timezone', TIMEZONE);
     ini_set('internal_encoding', ENCODE);
     ini_set('output_buffering', 'On');
     error_reporting(E_ALL | E_STRICT | E_NOTICE);
     //设置是否开启调试,线上环境不要开启
     if (defined('__PI_EN_DEBUG') || isset($_GET['__PI_EN_DEBUG'])) {
         $this->debug = true;
     }
     //必须先设置运行的类型和运行的环境
     if (empty($this->mode) || !is_string($this->mode)) {
         die('pi.err not set or set a wrong mode');
     }
     $this->appId = $this->_genAppid();
     Pi::$appId = $this->appId;
     //当要在其他框架或者非pi框架的项目内部嵌入的pi框架的代码
     //需要定义mode为com,然后执行嵌入式的初始化
     if ('com' == $this->mode) {
         $this->_comInit();
     } else {
         $this->_init();
     }
 }
Ejemplo n.º 2
0
Archivo: Pi.php Proyecto: hihus/pi
 protected function initEnv()
 {
     //设置是否开启调试,线上环境不要开启
     if (defined('__PI_EN_DEBUG')) {
         $this->debug = true;
     }
     if (true === $this->debug) {
         ini_set('display_errors', 1);
     }
     //必须先设置运行的类型和运行的环境
     if (empty($this->mode) || !is_string($this->mode)) {
         die('pi.err not set or set a wrong mode');
     }
     //生成进程唯一标识
     $this->appId = $this->genAppid();
     Pi::$appId = $this->appId;
     //对PI_COM_ROOT的目录要求
     $com_need_dirs = Pi::get('COM_DIR', array('export', 'lib', 'logic', 'model', 'conf'));
     $com_dirs = array_flip(scandir(PI_COM_ROOT));
     foreach ($com_need_dirs as $d) {
         if (!isset($com_dirs[$d])) {
             die('pi.err com root need init the dir: ' . $d);
         }
     }
 }