当前位置: 首页>>代码示例>>PHP>>正文


PHP Http::parseQuery方法代码示例

本文整理汇总了PHP中Http::parseQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::parseQuery方法的具体用法?PHP Http::parseQuery怎么用?PHP Http::parseQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Http的用法示例。


在下文中一共展示了Http::parseQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct($in = false, $cookieMessagesName = false)
 {
     //+	parse input{
     if ($in === false) {
         //apply default
         //+	Handle GET and POST variables{
         $in['get'] = $_SERVER['QUERY_STRING'];
         //we take it from here b/c php will replace characters like '.' and will ignore duplicate keys when forming $_GET
         //can cause script to hang (if no stdin), so don't run if in script unless configured to
         if (!$_ENV['inScript'] || $_ENV['scriptGetsStdin']) {
             //multipart forms can either result in 1. input being blank or 2. including the upload.  In case 1, post vars can be taken from $_POST.  In case 2, need to avoid putting entire file in memory by parsing input
             if (substr($_SERVER['CONTENT_TYPE'], 0, 19) != 'multipart/form-data') {
                 $in['post'] = file_get_contents('php://input');
                 $in['post'] = $in['post'] ? $in['post'] : file_get_contents('php://stdin');
             } elseif ($_POST) {
                 $in['post'] = http_build_query($_POST);
             }
         }
         if ($_SERVER['CONTENT_TYPE'] == 'application/json') {
             $in['post'] = ['json' => json_decode($in['post'])];
         } else {
             $in['post'] = Http::parseQuery($in['post'], $_ENV['pageInPHPStyle']);
         }
         $in['get'] = Http::parseQuery($in['get'], $_ENV['pageInPHPStyle']);
         $this->in = Arrays::merge($in['get'], $in['post']);
         //+	}
     } elseif (is_array($in)) {
         $this->in = $in;
     } else {
         $this->in = Http::parseQuery($in, $_ENV['pageInPHPStyle']);
     }
     $this->originalIn = $this->in;
     if ($_ENV['stripInputContexts']) {
         $this->in = self::removeInputContexts($this->in);
     }
     //+	}
     //+	Handle COOKIE system messages{
     if ($cookieMessagesName === false) {
         //apply default
         $cookieMessagesName = '_PageMessages';
     }
     //Page message are intended to be shown on viewed pages, not ajax responses, so ignore on ajax
     if ($cookieMessagesName && $_COOKIE[$cookieMessagesName] && !$this->in['_ajax']) {
         do {
             $cookie = @unserialize($_COOKIE[$cookieMessagesName]);
             if (is_array($cookie)) {
                 $code = self::saveMessagesCode($cookie['data']);
                 if ($cookie['code'] == $code) {
                     if (is_array($cookie['target'])) {
                         if (!array_diff($cookie['target'], Route::$urlTokens)) {
                             $this->messages = @unserialize($cookie['data']);
                         } else {
                             //not on right page, so break
                             break;
                         }
                     } else {
                         $this->messages = @unserialize($cookie['data']);
                     }
                 }
             }
             Cookie::remove($cookieMessagesName);
         } while (false);
     }
     //+	}
     //load db if configured
     if ($_ENV['database']['default']) {
         $this->db = Db::init(null, $_ENV['database']['default']);
     }
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:69,代码来源:Control.php

示例2: standardizeConcernData

 function standardizeConcernData($concernData)
 {
     if (is_string($concernData)) {
         $concernData = Http::parseQuery($concernData);
         $standard = array();
         foreach ($concernData as $k => $v) {
             if ($k[0] == '-') {
                 $standard[substr($k, 1)] = null;
             } else {
                 $standard[$k] = $v;
             }
         }
         return $standard;
     }
     return $concernData;
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:16,代码来源:CrudPage.php


注:本文中的Http::parseQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。