©
このドキュメントでは、 php中国語ネットマニュアル リリース
(PECL pecl_http >= 0.10.0)
HttpRequest::addQueryData — Add query data
$query_params
)Add parameters to the query parameter list, leaving previously set unchanged.
Affects any request type.
query_params
an associative array as parameter containing the query fields to add
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
[#1] Anonymous [2009-05-21 18:52:31]
Litte example :
/Tests/get.php :
========================
<?php
header('Content-Type: text/plain') ;
print_r($_GET) ;
?>
========================
/Tests/http.php :
========================
<?php
header('Content-Type: text/plain') ;
$request = new HttpRequest('http://127.0.0.1/Tests/get.php?foo=bar') ;
$request->addQueryData(array('baz' => 'qux')) ;
$response = new HttpMessage($request->send( )) ;
echo $response->getBody( ) ;
?>
========================
Run /Test/http.php display :
========================
Array
(
[foo] => bar
[baz] => qux
)
========================
So HttpRequest::addQueryData( ) deals with hard-coded GET data and complete them.