public function run() { $domain = explode('.', $_SERVER['HTTP_HOST']); $len = count($domain); $_W['v_remember_encrypt'] = '.' . $domain[$len - 2] . '.' . $domain[$len - 1]; //将domain注册到配置文件 ini_set('session.cookie_domain', $_W['v_remember_encrypt']); //限制二级域名; session_start(); $this->init(); $match = $this->router->match($this->request->getPathInfo()); if ($match != false) { $this->request->params = array_merge($this->request->params, $match['params']); } else { throw new \Exception('请求的地址有问题'); } $target = $match['target']; $return = array(); if (empty($charset)) { $charset = 'utf-8'; } if (empty($contentType)) { $contentType = 'text/html'; } // 网页字符编码 header('Content-Type:' . $contentType . '; charset=' . $charset); header('Cache-control: '); // 页面缓存控制 header('X-Powered-By:Video'); ob_start(); if (is_callable($target)) { $return = call_user_func($target, $match['params']); } if (is_string($target)) { list($controller, $method) = explode(':', $target); $controller = new $controller($this->request); call_user_func_array(array($controller, $method), $match['params']); } ob_end_flush(); // 输出模板文件 }