示例#1
0
文件: F.php 项目: storm12358/toc
 /**
  * web 请求
  * @param  string $value [description]
  * @return [type]        [description]
  */
 public function runHttpRequest()
 {
     $this->request = new Request();
     $this->router = new Router();
     // 获取 url
     $base_uri = $this->getBaseUri();
     // 获取路由 controller 和 action
     $route_mapping = $this->router->getRouteMapping($base_uri);
     if (empty($route_mapping)) {
         Response::redirect("/error.html", 302);
     }
     $params = $this->request->getParameters();
     // url 正则匹配数组
     $matches = $this->router->getMatches();
     // 执行拦截器操作
     $this->execInterceptors($route_mapping["controller"], $route_mapping["action"], $params, $matches);
     // 执行 controller 操作
     $this->execAction($route_mapping["controller"], $route_mapping["action"], $params, $matches);
 }
示例#2
0
 function redirect($url = '', $replace = true, $http_code = 302)
 {
     if (strpos($url, '/') || strpos($url, '/') != 0) {
         $url = '/' . $url;
     }
     if (APP_NAME == 'Admin') {
         $params = explode('/', $url);
         if ($params[1] != 'auth') {
             $params[1] .= '-setting';
         }
         $url = implode('/', $params);
     }
     $redirect = Response::init();
     return $redirect->redirect($url . '.' . TEMPLATE_TYPE, $replace, $http_code);
 }
示例#3
0
文件: Helper.php 项目: imjcw/terse
 function redirect($url = '', $replace = true, $http_code = 302)
 {
     $redirect = Response::init();
     return $redirect->redirect($url, $replace, $http_code);
 }