コード例 #1
0
ファイル: Sql.php プロジェクト: chaoyanjie/MonkeyPHP
 /**
  * 构造方法
  *
  * @param Monkey\App $app
  * @param mixed|null $config 配置
  */
 public function __construct($app, $config)
 {
     $this->app = $app;
     self::$dir = dir_format($app->DIR . (isset($config['sql_dir']) ? $config['sql_dir'] : '/logs/sql'));
     self::$dir .= '/' . date("Y-m-d", $app->TIME) . '/' . date("H", $app->TIME);
     $app->shutdown()->register(array($this, 'write'));
 }
コード例 #2
0
ファイル: Response.php プロジェクト: chaoyanjie/MonkeyPHP
 /**
  * 构造方法
  *
  * @param Monkey\App $app
  */
 public function __construct($app)
 {
     $this->app = $app;
     if ('HEAD' == $app->request()->getMethod()) {
         $this->setHttpHeaderOnly(true);
     }
     $this->charset = $app->CHARSET;
     $app->shutdown()->register(array($this, 'send'));
     if (substr($this->app->request()->header()->getContentType(), -4) == 'json') {
         $this->setJson();
     }
     if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], 'gzip') !== false && !ini_get('zlib.output_compression') && extension_loaded("zlib") && function_exists('gzencode')) {
         ob_start("ob_gzhandler");
     } else {
         ob_start();
     }
 }