PHP Doku:: HttpQueryString constructor - function.httpquerystring-construct.html

Verlauf / Chronik / History: (2) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige DiensteHTTPThe HttpQueryString classHttpQueryString::__construct

Ein Service von Reinhard Neidl - Webprogrammierung.

The HttpQueryString class

<<The HttpQueryString class

HttpQueryString::get>>

HttpQueryString::__construct

(PECL pecl_http >= 0.22.0)

HttpQueryString::__constructHttpQueryString constructor

Beschreibung

final public void HttpQueryString::__construct ([ bool $global = true [, mixed $add ]] )

Creates a new HttpQueryString object instance.

Operates on and modifies $_GET and $_SERVER['QUERY_STRING'] if global is TRUE.

Parameter-Liste

global

whether to operate on $_GET and $_SERVER['QUERY_STRING']

add

additional/initial query string parameters

Fehler/Exceptions

Throws HttpRuntimeException.


Ein BenutzerBeitrag:
- Beiträge aktualisieren...
michal dot kocarek at brainbox dot cz
11.06.2009 16:19
Note about first argument when calling the constructor:
– if true, instance will have initially exactly same query string as PHP received when user accessed the page
– if false, instance will be empty.

<?php
// Imagine that user puts "test.php?name=JamesBond&age=30" into browser, then…

$query = new HttpQueryString(); // query is "name=JamesBond&age=30". (First argument is true by default.)
$query = new HttpQueryString(false); // query is empty
$query = new HttpQueryString(true, 'age=31'); // query is "name=JamesBond&age=31", name was preserved, age was updated
$query = new HttpQueryString(false, 'age=31'); // query is "age=31"
?>

Second argument can be string and associative array, same as for HttpQueryString->set() method.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)