本文整理汇总了PHP中Zend\Uri\Uri::getQueryAsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Uri::getQueryAsArray方法的具体用法?PHP Uri::getQueryAsArray怎么用?PHP Uri::getQueryAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Uri\Uri
的用法示例。
在下文中一共展示了Uri::getQueryAsArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param OAuth\Consumer $consumer
* @param string $url
* @param string $method
* @param array $params
*/
public function __construct($consumer, $url, $method, $params = array())
{
$this->_consumer = $consumer;
$this->_method = $method;
//normalize the uri: remove the query params
//and store them alonside the oauth and user params
$this->_uri = new \MediaCore\Uri($url);
$this->_unencodedQueryParams = $this->_uri->getQueryAsArray(true);
$this->_uri->setQuery('');
$this->_params = $params;
}
示例2: constructRedirectUri
protected function constructRedirectUri($uri = null, array $query = array())
{
$uri = new Uri($uri);
if (!empty($query)) {
$query = $uri->getQueryAsArray() + $query;
$uri->setQuery($query);
}
return $uri;
}
示例3: getUrl
/**
* Get Url
*
* @return string
*/
public function getUrl()
{
if ($this->uri instanceof Uri) {
$url = array('href' => $this->uri->toString());
$query = $this->uri->getQueryAsArray();
if (sizeof($query) > 0) {
$url['query'] = $query;
}
return $url;
}
return;
}
示例4: clearUri
/**
* Get clear uri.
*
* @static
*
* @param \Zend\Uri\Uri $uri
*
* @return boolean|\Zend\Uri\Uri False if uri is not auhorized
*/
public static function clearUri(Uri $uri)
{
if ($uri->getScheme() !== 'http') {
return false;
}
$query = $uri->getQueryAsArray();
if (empty($query['v'])) {
return false;
}
$uri->setQuery(array('v' => $query['v']));
$uri->setHost('www.youtube.com');
$uri->setPath('/watch');
// clear
$uri->setPort(0);
$uri->setUserInfo('');
$uri->setFragment('');
return $uri;
}
示例5: getValueForPrice
/**
* @param $price
* @return FilterValue|null
* @throws UnparseableValueException
*/
public function getValueForPrice($price)
{
$values = $this->getFilterValues();
foreach ($values as $value) {
$url = $value->getLink();
$uri = new Uri($url);
$parts = $uri->getQueryAsArray();
if (isset($parts['price'])) {
$priceParts = explode('-', $parts['price']);
if (!$priceParts[0]) {
$priceParts[0] = -1;
}
if (!$priceParts[1]) {
$priceParts[1] = PHP_INT_MAX;
}
// term 0, price filters seem to use less than
if ($price >= $priceParts[0] & $price < $priceParts[1]) {
return $value;
}
}
}
return null;
}
示例6: testGetQueryAsArrayReturnsCorrectArray
/**
* @group ZF-1480
*/
public function testGetQueryAsArrayReturnsCorrectArray()
{
$url = new Uri('http://example.com/foo/?test=a&var[]=1&var[]=2&some[thing]=3');
$this->assertEquals('test=a&var[]=1&var[]=2&some[thing]=3', $url->getQuery());
$exp = array('test' => 'a', 'var' => array(1, 2), 'some' => array('thing' => 3));
$this->assertEquals($exp, $url->getQueryAsArray());
}
示例7: canonizeUrl
/**
* Canonize URL with params, set `appkey` if not specified yet
*
* @param string|Uri $uri
* @param array $params
*
* @return Uri
*/
protected function canonizeUrl($uri, array $params = array())
{
if (!$uri instanceof Uri) {
$uri = new Uri($uri);
}
if (!isset($params['appkey'])) {
$params['appkey'] = Pi::config('identifier');
}
$params = array_merge($uri->getQueryAsArray(), $params);
$uri->setQuery($params);
return $uri;
}
示例8: getQueryAsArray
/**
* Return the query string as an associative array of key => value pairs
*
* @return array
*/
public function getQueryAsArray()
{
return $this->uri->getQueryAsArray();
}