當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Uri_Http::setQueryArray方法代碼示例

本文整理匯總了PHP中Zend_Uri_Http::setQueryArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Uri_Http::setQueryArray方法的具體用法?PHP Zend_Uri_Http::setQueryArray怎麽用?PHP Zend_Uri_Http::setQueryArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Uri_Http的用法示例。


在下文中一共展示了Zend_Uri_Http::setQueryArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _prepareRest

 /**
  * Call a remote REST web service URI and return the Zend_Http_Response object
  *
  * @param  string $path            The path to append to the URI
  * @throws Zend_Service_Exception
  * @return void
  */
 private final function _prepareRest($path, $query)
 {
     // Get the URI object and configure it
     if (!$this->_uri instanceof Zend_Uri) {
         throw new Zend_Service_Exception('URI object must be set before performing call');
     }
     // @todo this needs to be revisited
     if ($path[0] != '/' && $this->_uri[strlen($this->_uri) - 1] != '/') {
         $path = '/' . $path;
     }
     $this->_uri->setPath($path);
     if (!is_null($query) && is_string($query)) {
         $this->_uri->setQueryString($query);
     } elseif (is_array($query)) {
         $this->_uri->setQueryArray($query);
     }
     /**
      * Get the HTTP client and configure it for the endpoint URI.  Do this each time
      * because the Zend_Http_Client instance is shared among all Zend_Service_Abstract subclasses.
      */
     self::getHttpClient()->setUri($this->_uri);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:29,代碼來源:Rest.php

示例2: generateUrl

 public function generateUrl($parameters, Zend_Uri_Http $url)
 {
     $parts = $this->getParts();
     $n = count($parts);
     $path = $parts[0];
     for ($i = 1; $i < $n; $i += 3) {
         $type = $parts[$i];
         $name = $parts[$i + 1];
         $static = $parts[$i + 2];
         if (isset($parameters[$name])) {
             $path .= $this->encode($type, $parameters[$name]);
             unset($parameters[$name]);
         } else {
             if (array_key_exists($name, $this->defaults)) {
                 if (is_null($this->defaults[$name])) {
                     // Remove rest of params so they dont appear in querystring
                     for (; $i < $n; $i += 3) {
                         unset($parameters[$parts[$i + 1]]);
                     }
                     break;
                 } else {
                     $path .= $this->encode($type, $this->defaults[$name]);
                 }
             } else {
                 throw new Zend_Controller_Router_Exception("Missing required parameter {$name}");
             }
         }
         $path .= $static;
     }
     // Validate the path (and therefore parameters used so far) for this route
     if (0 == preg_match($this->getRegularExpression(), $path)) {
         throw new Zend_Controller_Router_Exception("{$path} does not match route {$this->getName()} {$this->getRegularExpression()}");
     }
     // Remove parameters that are at their defaults for this route
     if (!empty($this->defaults)) {
         $parameters = array_diff_assoc($parameters, $this->defaults);
     }
     $url->setPath($path);
     $url->setQueryArray($parameters);
     return $url;
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:41,代碼來源:YARouter.php


注:本文中的Zend_Uri_Http::setQueryArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。