当前位置: 首页>>代码示例>>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;未经允许,请勿转载。