本文整理匯總了PHP中Google_Http_Request::getQueryParams方法的典型用法代碼示例。如果您正苦於以下問題:PHP Google_Http_Request::getQueryParams方法的具體用法?PHP Google_Http_Request::getQueryParams怎麽用?PHP Google_Http_Request::getQueryParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Google_Http_Request
的用法示例。
在下文中一共展示了Google_Http_Request::getQueryParams方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRequestParameters
public function testRequestParameters()
{
$url = 'http://localhost:8080/foo/bar?foo=a&foo=b&wowee=oh+my';
$url2 = 'http://localhost:8080/foo/bar?foo=a&foo=b&wowee=oh+my&hi=there';
$request = new Google_Http_Request($url);
$request->setExpectedClass("Google_Client");
$this->assertEquals(2, count($request->getQueryParams()));
$request->setQueryParam("hi", "there");
$this->assertEquals($url2, $request->getUrl());
$this->assertEquals("Google_Client", $request->getExpectedClass());
$urlPath = "/foo/bar";
$request = new Google_Http_Request($urlPath);
$this->assertEquals($urlPath, $request->getUrl());
$request->setBaseComponent("http://example.com");
$this->assertEquals("http://example.com" . $urlPath, $request->getUrl());
$url3a = 'http://localhost:8080/foo/bar';
$url3b = 'foo=a&foo=b&wowee=oh+my';
$url3c = 'foo=a&foo=b&wowee=oh+my&hi=there';
$request = new Google_Http_Request($url3a . "?" . $url3b, "POST");
$request->setQueryParam("hi", "there");
$request->maybeMoveParametersToBody();
$this->assertEquals($url3a, $request->getUrl());
$this->assertEquals($url3c, $request->getPostBody());
$url4 = 'http://localhost:8080/upload/foo/bar?foo=a&foo=b&wowee=oh+my&hi=there';
$request = new Google_Http_Request($url);
$this->assertEquals(2, count($request->getQueryParams()));
$request->setQueryParam("hi", "there");
$base = $request->getBaseComponent();
$request->setBaseComponent($base . '/upload');
$this->assertEquals($url4, $request->getUrl());
}
示例2: testRequestParameters
public function testRequestParameters()
{
$url = 'http://localhost:8080/foo/bar?foo=a&foo=b&wowee=oh+my';
$url2 = 'http://localhost:8080/foo/bar?foo=a&foo=b&wowee=oh+my&hi=there';
$request = new Google_Http_Request($this->getClient(), $url);
$request->setExpectedClass("Google_Client");
$this->assertEquals(2, count($request->getQueryParams()));
$request->setQueryParam("hi", "there");
$this->assertEquals($url2, $request->getUrl());
$this->assertEquals("Google_Client", $request->getExpectedClass());
$url3a = 'http://localhost:8080/foo/bar';
$url3b = 'foo=a&foo=b&wowee=oh+my';
$url3c = 'foo=a&foo=b&wowee=oh+my&hi=there';
$request = new Google_Http_Request($this->getClient(), $url3a . "?" . $url3b, "POST");
$request->setQueryParam("hi", "there");
$request->maybeMoveParametersToBody();
$this->assertEquals($url3a, $request->getUrl());
$this->assertEquals($url3c, $request->getPostBody());
}