(PECL pecl_http >= 0.22.0)

HttpQueryString::setSet query string params


public string HttpQueryString::set ( mixed $params )

Set query string entry/entries. NULL values will unset the variable.

Список параметров


query string params to add

Возвращаемые значения

Returns the current query string.


In case anybody reads this and wonders what the params should be, it takes a key=>value array, not sure why it says mixed, or if there's other types you can give it.

= new HttpQueryString();
$http->set(array('page' => 1'sort' => 'asc'));

Should produce a query string page?page=1&sort=asc
2008-02-04 10:09:11
Function accepts string or associative array in the params argument.

= new HttpQueryString(false); // query is empty

$query->set(array('city' => 'Prague''age' => 34)); // query is "city=Prague&age=34"
$query->set('age=20&gender=male'); // query is "city=Prague&age=20&gender=male"

Also please note that variable can be unset *only* by passing NULL value in an associative array.

->set('city='); // query is "city=&age=20&gender=male"
$query->set(array('city' => null)); // and now "age=20&gender=male" ?>
2009-06-11 09:55:41

    Поддержать сайт на родительском проекте КГБ