private static function _clear() { self::$sql = null; self::$log = null; self::$start = null; self::$time = null; self::$server = null; self::$exception = null; self::$session = null; //self::$show; //self::$key; }
public function onRequest($request, $response) { try { CxBug::start(); $this->request = $request; $this->response = $response; $_COOKIE = isset($request->cookie) ? $request->cookie : array(); $_GET = isset($request->get) ? $request->get : array(); $_POST = isset($request->post) ? $request->post : array(); $_REQUEST = array_merge($_GET, $_POST); $_SERVER = array_merge($request->header, $request->server); SWOOLE_ENABLE_GZIP and $response->gzip(SWOOLE_ENABLE_GZIP); ob_start(); $url = new CxRouter($request->server['path_info']); if ($url->getController() == 'debug') { $this->_doBug($url); } else { $this->redirect and call_user_func($this->redirect, $url); $this->_doWith($url); $this->_onEnd(); } } catch (Exception $e) { //因为需要模拟die函数,所以此处需要catch处理 } $response->end(ob_get_contents()); ob_end_clean(); }