Example #1
0
 /**
  * @description request function 调用它
  * @param $query_key
  * @param int $query_position
  * @return null
  */
 public static function request($query_key, &$query_result, $query_position = 0)
 {
     switch (c('url_model')) {
         case URL_COMMON:
             return Route::getRequest($query_key, $query_result);
             break;
         case URL_PATHINFO:
             $uri = self::requestUri();
             var_dump($uri);
             $path = self::getUriPath();
             $path_array = $path;
             var_dump($path);
             if (count($path) >= 3) {
                 $path = array_slice($path, 3);
                 if ($path != null || isset($path[$query_position])) {
                     $query_result = $path[$query_position];
                     return true;
                 } else {
                     if (count($path_array) == 3) {
                         return self::getRequest($query_key, $query_result);
                     }
                 }
             }
             break;
         case URL_REWRITE:
             $path = self::getUriPath();
             $path_array = $path;
             if (!self::hasSelf() && $path[0] != '') {
                 if (count($path) >= 2) {
                     $path = array_slice($path, 2);
                 } else {
                 }
                 if ($path != null || isset($path[$query_position])) {
                     $query_result = $path[$query_position];
                     return true;
                 } else {
                     if (count($path_array) == 2) {
                         return self::getRequest($query_key, $query_result);
                     }
                 }
             } else {
                 if (count($path) >= 3) {
                     $path = array_slice($path, 3);
                     if ($path != null || isset($path[$query_position])) {
                         $query_result = $path[$query_position];
                         return true;
                     } else {
                         if (count($path_array) == 3) {
                             return self::getRequest($query_key, $query_result);
                         }
                     }
                 }
             }
             break;
     }
 }
Example #2
0
 /**
  * @description 加载controller类
  * @param $c
  * @return mixed
  */
 public static function loadController($controller = '')
 {
     // 判断controller是否为空
     if ($controller == '') {
         //为空时自动调用默认controller
         Route::getRequest(c('default_controller_request'), $controller);
     }
     return self::initController($controller);
 }