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


PHP http_build_query函数代码示例

本文整理汇总了PHP中http_build_query函数的典型用法代码示例。如果您正苦于以下问题:PHP http_build_query函数的具体用法?PHP http_build_query怎么用?PHP http_build_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * Constructs a book dialog
  * $action - GET or POST action to take.
  * $inclusions - NULL (in which case it does nothing), or an array of book IDs to include.
  * $exclusions - NULL (in which case it does nothing), or an array of book IDs to exclude.
  */
 public function __construct($header, $info_top, $info_bottom, $action, $inclusions, $exclusions)
 {
     $this->view = new Assets_View(__FILE__);
     $caller = $_SERVER["PHP_SELF"] . "?" . http_build_query(array());
     $this->view->view->caller = $caller;
     $this->view->view->header = $header;
     $this->view->view->info_top = $info_top;
     $this->view->view->info_bottom = $info_bottom;
     $this->view->view->action = $action;
     $database_books = Database_Books::getInstance();
     $book_ids = $database_books->getIDs();
     if (is_array($inclusions)) {
         $book_ids = $inclusions;
     }
     if (is_array($exclusions)) {
         $book_ids = array_diff($book_ids, $exclusions);
         $book_ids = array_values($book_ids);
     }
     foreach ($book_ids as $id) {
         $book_names[] = $database_books->getEnglishFromId($id);
     }
     $this->view->view->book_ids = $book_ids;
     $this->view->view->book_names = $book_names;
     $this->view->render("books2.php");
     Assets_Page::footer();
     die;
 }
开发者ID:alerque,项目名称:bibledit,代码行数:33,代码来源:books2.php

示例2: post_location_request

 function post_location_request($url, $data)
 {
     /*		$data_str = urlencode(http_build_query($data));
     		header("Host: $host\r\n");
     		header("POST $path HTTP/1.1\r\n");
     		header("Content-type: application/x-www-form-urlencoded\r\n");
     		header("Content-length: " . strlen($data_str) . "\r\n");
     		header("Connection: close\r\n\r\n");
     		header($data_str);
     		exit();*/
     $CI =& get_instance();
     $params = explode("&", urldecode(http_build_query($data)));
     $retHTML = '';
     if (!$CI->is_pjax) {
         $retHTML .= "<html>\n<body onLoad=\"document.send_form.submit();\">\n";
     }
     $retHTML .= '<form method="post" name="send_form" id="send_form"  action="' . $url . '">';
     foreach ($params as $string) {
         list($key, $value) = explode("=", $string);
         $retHTML .= "<input type=\"hidden\" name=\"" . $key . "\" value=\"" . addslashes($value) . "\">\n";
     }
     if ($CI->is_pjax) {
         $retHTML .= '</form><script>document.getElementById("send_form").submit();</script>';
     } else {
         $retHTML .= "</form>\n</body>\n</html>";
     }
     print $retHTML;
     exit;
 }
开发者ID:Calit2-UCI,项目名称:IoT_Map,代码行数:29,代码来源:payments_helper.php

示例3: mm_ux_log

function mm_ux_log($args = array())
{
    $url = "https://ssl.google-analytics.com/collect";
    global $title;
    if (empty($_SERVER['REQUEST_URI'])) {
        return;
    }
    $path = explode('wp-admin', $_SERVER['REQUEST_URI']);
    if (empty($path) || empty($path[1])) {
        $path = array("", " ");
    }
    $defaults = array('v' => '1', 'tid' => 'UA-39246514-3', 't' => 'pageview', 'cid' => md5(get_option('siteurl')), 'uid' => md5(get_option('siteurl') . get_current_user_id()), 'cn' => 'mojo_wp_plugin', 'cs' => 'mojo_wp_plugin', 'cm' => 'plugin_admin', 'ul' => get_locale(), 'dp' => $path[1], 'sc' => '', 'ua' => @$_SERVER['HTTP_USER_AGENT'], 'dl' => $path[1], 'dh' => get_option('siteurl'), 'dt' => $title, 'ec' => '', 'ea' => '', 'el' => '', 'ev' => '');
    if (isset($_SERVER['REMOTE_ADDR'])) {
        $defaults['uip'] = $_SERVER['REMOTE_ADDR'];
    }
    $params = wp_parse_args($args, $defaults);
    $test = get_transient('mm_test', '');
    if (isset($test['key']) && isset($test['name'])) {
        $params['cm'] = $params['cm'] . "_" . $test['name'] . "_" . $test['key'];
    }
    //use test account for testing
    if (defined('WP_DEBUG') && WP_DEBUG) {
        $params['tid'] = 'UA-19617272-27';
    }
    $z = wp_rand(0, 1000000000);
    $query = http_build_query(array_filter($params));
    $args = array('body' => $query, 'method' => 'POST', 'blocking' => false);
    $url = add_query_arg(array('z' => $z), $url);
    wp_remote_post($url, $args);
}
开发者ID:hyperhy,项目名称:hyperhy,代码行数:30,代码来源:user-experience-tracking.php

示例4: redirect

 /**
  * Form a redirect URI to send the user to.
  *
  * @param array $scopes
  *
  * @return string
  */
 public function redirect($scopes = [])
 {
     $url = self::$base_url . 'oauth/authorize';
     $scopes = empty($scopes) ? null : implode(' ', $scopes);
     $params = ['response_type' => 'code', 'redirect_uri' => $this->callback, 'client_id' => $this->client_id, 'scope' => $scopes];
     return $url . '?' . http_build_query($params, null, '&', PHP_QUERY_RFC3986);
 }
开发者ID:evetools-php,项目名称:apihandler,代码行数:14,代码来源:Handler.php

示例5: Put

 /**
  * Returns a json.
  *
  * @param string       $api_path The api path
  * @param string|array $file     The filepath (string) or fileinfo ['filepath' => '', 'filetype' => ''] (array)
  *
  * @return string
  */
 public function Put($api, $file = '', $query = [])
 {
     $ch = $this->getHandler();
     $query = is_array($query) ? http_build_query($query) : $query;
     $this->url = $this->api_path . $api . ($query ? "?{$query}" : '');
     if (is_array($file)) {
         if (isset($file['filepath'])) {
             $fp = fopen($file['filepath'], 'r');
         } elseif (isset($file['fp'])) {
             $fp = $file['fp'];
         }
         $this->headers[] = "Content-Type: {$file['filetype']}";
     } else {
         $fp = fopen($file, 'r');
         if ($img_info = getimagesize($file)) {
             // get mime type wher file is a image
             $this->headers[] = "Content-Type: {$img_info['mime']}";
         }
     }
     curl_setopt($ch, CURLOPT_PUT, 1);
     curl_setopt($ch, CURLOPT_INFILE, $fp);
     if ($this->headers) {
         curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
     }
     return $this->run($ch);
 }
开发者ID:higherchen,项目名称:pikachu,代码行数:34,代码来源:Http.php

示例6: curlSetopts

 private function curlSetopts($ch, $method, $payload, $request_headers)
 {
     curl_setopt($ch, CURLOPT_HEADER, true);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt($ch, CURLOPT_USERAGENT, 'HAC');
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
     curl_setopt($ch, CURLOPT_TIMEOUT, 30);
     if ($this->debug) {
         curl_setopt($ch, CURLOPT_VERBOSE, true);
     }
     if ('GET' == $method) {
         curl_setopt($ch, CURLOPT_HTTPGET, true);
     } else {
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
         if (!empty($request_headers)) {
             curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
         }
         if (!empty($payload)) {
             if (is_array($payload)) {
                 $payload = http_build_query($payload);
             }
             curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
         }
     }
 }
开发者ID:robertholf,项目名称:PipelineDeals-API-PHP-Adapter,代码行数:29,代码来源:pipelinedeals.php

示例7: getApiRequestUrl

 /**
  * Return the url for the API request
  *
  * @param \Phergie\Irc\Plugin\React\Command\CommandEvent $event
  *
  * @return string
  */
 public function getApiRequestUrl(Event $event)
 {
     $params = $event->getCustomParams();
     $query = trim(implode(" ", $params));
     $querystringParams = array('q' => $query, 'appid' => $this->appId);
     return sprintf("%s?%s", $this->apiUrl, http_build_query($querystringParams));
 }
开发者ID:chrismou,项目名称:phergie-irc-plugin-react-weather,代码行数:14,代码来源:OpenWeatherMap.php

示例8: connectUrl

 public function connectUrl($params = array())
 {
     $query = Braintree_Util::camelCaseToDelimiterArray($params, '_');
     $query['client_id'] = $this->_config->getClientId();
     $url = $this->_config->baseUrl() . '/oauth/connect?' . http_build_query($query);
     return $this->signUrl($url);
 }
开发者ID:nstungxd,项目名称:F2CA5,代码行数:7,代码来源:OAuthGateway.php

示例9: format

 function format()
 {
     $base = $_REQUEST['_router_'];
     if ($this->curpage > 1) {
         $html[] = "<a href='{$this->router}'>首页</a>";
     }
     $pages = array();
     for ($i = 1; $i <= $this->pagenum; $i++) {
         if ($i <= 3 || abs($this->curpage - $i) < 3 || $this->pagenum - $i <= 3) {
             $pages[] = $i;
             continue;
         }
     }
     $html = array();
     foreach ($pages as $i => $p) {
         if ($i > 1 && $p - $pages[$i - 1] > 1) {
             $html[] = '...';
         } else {
             $this->query['page'] = $p;
             $url = $this->router;
             $url .= strpos($url, '?') ? '&' : '?';
             $url .= http_build_query($this->query);
             //echo $url;
             $html[] = "<a href='{$url}'>{$p}</a>";
         }
     }
     return "共{$this->records}记录,第{$this->curpage}/{$this->pagenum}页&nbsp;" . implode('', $html);
 }
开发者ID:BGCX261,项目名称:zhflash-svn-to-git,代码行数:28,代码来源:page.php

示例10: __construct

 /**
  * @param string         $Name
  * @param                $Path
  * @param IIconInterface $Icon
  * @param array          $Data
  * @param bool|string    $ToolTip
  */
 public function __construct($Name, $Path, IIconInterface $Icon = null, $Data = array(), $ToolTip = true)
 {
     $this->Name = $Name;
     $this->Template = $this->getTemplate(__DIR__ . '/External.twig');
     $this->Template->setVariable('ElementName', $Name);
     $this->Template->setVariable('ElementType', 'btn btn-default');
     if (null === $Icon) {
         $Icon = new Extern();
     }
     $this->Template->setVariable('ElementIcon', $Icon);
     if (!empty($Data)) {
         $Signature = (new Authenticator(new Get()))->getAuthenticator();
         $Data = '?' . http_build_query($Signature->createSignature($Data, $Path));
     } else {
         $Data = '';
     }
     $this->Template->setVariable('ElementPath', $Path . $Data);
     if ($ToolTip) {
         if (is_string($ToolTip)) {
             $this->Template->setVariable('ElementToolTip', $ToolTip);
         } else {
             $this->Template->setVariable('ElementToolTip', $Path);
         }
     }
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:32,代码来源:External.php

示例11: handle_method_spoofing

 /**
  * Handles method spoofing.
  * 
  * Callers should use this method as one of the first methods in their
  * scripts. This method does the following:
  * - The <em>real</em> HTTP method must be POST.
  * - Modify "environment variables" <var>$_SERVER['QUERY_STRING']</var>,
  *   <var>$_SERVER['REQUEST_URI']</var>,
  *   <var>$_SERVER['REQUEST_METHOD']</var>,
  *   <var>$_SERVER['CONTENT_LENGTH']</var>,
  *   <var>$_SERVER['CONTENT_TYPE']</var> as necessary.
  * @return void
  */
 public static function handle_method_spoofing()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST' and isset($_GET['http_method'])) {
         $http_method = strtoupper($_GET['http_method']);
         unset($_GET['http_method']);
         if ($http_method === 'GET' && strstr(@$_SERVER['CONTENT_TYPE'], 'application/x-www-form-urlencoded') !== false) {
             $_GET = $_POST;
             $_POST = array();
         } elseif ($http_method === 'PUT' && strstr(@$_SERVER['CONTENT_TYPE'], 'application/x-www-form-urlencoded') !== false && isset($_POST['entity'])) {
             self::$inputhandle = tmpfile();
             fwrite(self::$inputhandle, $_POST['entity']);
             fseek(self::$inputhandle, 0);
             $_SERVER['CONTENT_LENGTH'] = strlen($_POST['entity']);
             unset($_POST['entity']);
             if (isset($_POST['http_content_type'])) {
                 $_SERVER['CONTENT_TYPE'] = $_POST['http_content_type'];
                 unset($_POST['http_content_type']);
             } else {
                 $_SERVER['CONTENT_TYPE'] = 'application/octet-stream';
             }
         } elseif ($http_method === 'PUT' && strstr(@$_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== false && @$_FILES['entity']['error'] === UPLOAD_ERR_OK) {
             self::$inputhandle = fopen($_FILES['entity']['tmp_name'], 'r');
             $_SERVER['CONTENT_LENGTH'] = $_FILES['entity']['size'];
             $_SERVER['CONTENT_TYPE'] = $_FILES['entity']['type'];
         }
         $_SERVER['QUERY_STRING'] = http_build_query($_GET);
         $_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
         if ($_SERVER['QUERY_STRING'] != '') {
             $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
         }
         $_SERVER['REQUEST_METHOD'] = $http_method;
     }
 }
开发者ID:pieterb,项目名称:REST,代码行数:46,代码来源:REST.php

示例12: urlParamsResolver

 /**
  * methodName
  *
  * @param string $url
  * @param array $paramToAdd
  * @param array $paramToRemove
  * @return string
  */
 private static function urlParamsResolver($url, $paramToAdd = [])
 {
     $getArray = $_GET;
     $currentUrl = getUrl();
     $queryString = http_build_query(array_merge(is_array($getArray) ? $getArray : [$getArray], $paramToAdd));
     return $currentUrl . ($queryString ? '?' . $queryString : '');
 }
开发者ID:bonaccorsop,项目名称:JambonOrders,代码行数:15,代码来源:AppSerializer.php

示例13: checkUser

 public function checkUser()
 {
     if (isset($_REQUEST['code'])) {
         $keys = array();
         $keys['code'] = $_REQUEST['code'];
         $keys['redirect_uri'] = U('public/Widget/displayAddons', array('type' => $_REQUEST['type'], 'addon' => 'Login', 'hook' => 'no_register_display'));
         try {
             $token = $this->_oauth->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
             $token = null;
         }
     } else {
         $keys = array();
         $keys['refresh_token'] = $_REQUEST['code'];
         try {
             $token = $this->_oauth->getAccessToken('token', $keys);
         } catch (OAuthException $e) {
             $token = null;
         }
     }
     if ($token) {
         setcookie('weibojs_' . $this->_oauth->client_id, http_build_query($token));
         $_SESSION['sina']['access_token']['oauth_token'] = $token['access_token'];
         $_SESSION['sina']['access_token']['oauth_token_secret'] = $token['refresh_token'];
         $_SESSION['sina']['expire'] = time() + $token['expires_in'];
         $_SESSION['sina']['uid'] = $token['uid'];
         $_SESSION['open_platform_type'] = 'sina';
         return $token;
     } else {
         return false;
     }
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:32,代码来源:sina.class.php

示例14: actionPost

 public function actionPost($url, $params, $multipart = FALSE, $version = CURL_HTTP_VERSION_NONE)
 {
     if (function_exists('curl_init')) {
         $ch = curl_init();
         $timeout = 60;
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_HTTP_VERSION, $version);
         curl_setopt($ch, CURLOPT_POST, TRUE);
         if ($multipart) {
             curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
         } else {
             curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
         }
         curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
         $data = curl_exec($ch);
         if ($data === FALSE) {
             throw new Exception(curl_errno($ch));
         }
         curl_close($ch);
         return $data;
     } else {
         return FALSE;
     }
 }
开发者ID:Veeresh8,项目名称:E-Dresser,代码行数:25,代码来源:sendsms_helper.php

示例15: anchorActionDelete

 public static function anchorActionDelete($key)
 {
     $params = array('db' => Request::factory()->getDb(), 'cmd' => 'DEL ' . urlencode($key), 'back' => Request::factory()->getBack());
     $url = 'http://' . Request::factory()->getServerName() . '/?' . http_build_query($params);
     $title = 'DEL ' . htmlspecialchars($key);
     return '<a class="cmd delete" href="' . $url . '" title="' . $title . '">Delete</a>';
 }
开发者ID:xingcuntian,项目名称:readmin,代码行数:7,代码来源:Strings.php


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