Esempio n. 1
0
 private static function getQueryStr()
 {
     $system = systemInfo();
     //命令行运行检查
     if (MpInput::isCli()) {
         global $argv;
         $pathinfo_query = isset($argv[1]) ? $argv[1] : '';
     } else {
         $pathinfo = @parse_url($_SERVER['REQUEST_URI']);
         if (empty($pathinfo)) {
             if ($system['debug']) {
                 trigger404('request parse error:' . $_SERVER['REQUEST_URI']);
             } else {
                 trigger404();
             }
         }
         //pathinfo模式下有?,那么$pathinfo['query']也是非空的,这个时候查询字符串是PATH_INFO和query
         $query_str = empty($pathinfo['query']) ? '' : $pathinfo['query'];
         $path_info = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : (isset($_SERVER['REDIRECT_PATH_INFO']) ? $_SERVER['REDIRECT_PATH_INFO'] : '');
         $pathinfo_query = empty($path_info) ? $query_str : $path_info . '&' . $query_str;
     }
     if ($pathinfo_query) {
         $pathinfo_query = trim($pathinfo_query, '/&');
     }
     //urldecode 解码所有的参数名,解决get表单会编码参数名称的问题
     $pq = $_pq = array();
     $_pq = explode('&', $pathinfo_query);
     foreach ($_pq as $value) {
         $p = explode('=', $value);
         if (isset($p[0])) {
             $p[0] = urldecode($p[0]);
         }
         $pq[] = implode('=', $p);
     }
     $pathinfo_query = implode('&', $pq);
     return $pathinfo_query;
 }
Esempio n. 2
0
 private static function getQueryStr()
 {
     $system = systemInfo();
     if (MpInput::isCli()) {
         global $argv;
         $pathinfo_query = isset($argv[1]) ? $argv[1] : '';
     } else {
         $pathinfo = @parse_url($_SERVER['REQUEST_URI']);
         if (empty($pathinfo)) {
             if ($system['debug']) {
                 trigger404('request parse error:' . $_SERVER['REQUEST_URI']);
             } else {
                 trigger404();
             }
         }
         $query_str = empty($pathinfo['query']) ? '' : $pathinfo['query'];
         $pathinfo_query = empty($_SERVER['PATH_INFO']) ? $query_str : $_SERVER['PATH_INFO'] . '&' . $query_str;
     }
     if ($pathinfo_query) {
         $pathinfo_query = trim($pathinfo_query, '/&');
     }
     $pq = $_pq = array();
     $_pq = explode('&', $pathinfo_query);
     foreach ($_pq as $value) {
         $p = explode('=', $value);
         if (isset($p[0])) {
             $p[0] = urldecode($p[0]);
         }
         $pq[] = implode('=', $p);
     }
     $pathinfo_query = implode('&', $pq);
     return $pathinfo_query;
 }