本文整理汇总了PHP中SimpleUrl::encodeRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleUrl::encodeRequest方法的具体用法?PHP SimpleUrl::encodeRequest怎么用?PHP SimpleUrl::encodeRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleUrl
的用法示例。
在下文中一共展示了SimpleUrl::encodeRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _dispatchRequest
/**
* Sends the headers.
* @param SimpleSocket $socket Open socket.
* @param string $method HTTP request method,
* usually GET.
* @param string $content Content to send with request.
* @access protected
*/
function _dispatchRequest(&$socket, $method, $content)
{
parent::_dispatchRequest($socket, $method, SimpleUrl::encodeRequest($content));
}
示例2: testRequestEncoding
function testRequestEncoding()
{
$this->assertEqual(SimpleUrl::encodeRequest(array('a' => '1')), 'a=1');
$this->assertEqual(SimpleUrl::encodeRequest(false), '');
$this->assertEqual(SimpleUrl::encodeRequest(array('a' => array('1', '2'))), 'a=1&a=2');
}
示例3: SimpleHttpPushRequest
/**
* Builds the appropriate HTTP request object.
* @param string $method Fetching method.
* @param SimpleUrl $url Target to fetch as url object.
* @param hash $parameters POST/GET parameters.
* @return SimpleHttpRequest New request object.
* @access protected
*/
function &_createRequest($method, $url, $parameters)
{
if ($method == 'POST') {
$request =& new SimpleHttpPushRequest($url, SimpleUrl::encodeRequest($parameters), 'POST');
$request->addHeaderLine('Content-Type: application/x-www-form-urlencoded');
return $request;
}
return new SimpleHttpRequest($url, $method);
}
示例4: SimpleHttpPostRequest
/**
* Saves the URL ready for fetching.
* @param SimpleUrl $url URL as object.
* @param array $parameters Content to send.
* @access public
*/
function SimpleHttpPostRequest($url, $parameters)
{
$this->SimpleHttpRequest($url, 'POST');
$this->_pushed_content = SimpleUrl::encodeRequest($parameters);
}