JURI/getQuery
From Joomla! Documentation
< JURI(Difference between revisions)
(New page: Returns the query part of the URI represented by the JURI object. ===Syntax=== string getQuery( $toArray ) where: {| class="wikitable" !Argument !Data type !Description !Default |- |$toAr...) |
m (→See also: re-categorisation) |
||
| Line 42: | Line 42: | ||
* [[JURI/setQuery|JURI->setQuery]] | * [[JURI/setQuery|JURI->setQuery]] | ||
* [[JURI/buildQuery|JURI->buildQuery]] | * [[JURI/buildQuery|JURI->buildQuery]] | ||
| − | <noinclude> | + | <noinclude>[[Category:JURI]]</noinclude> |
Latest revision as of 11:34, 9 August 2012
Returns the query part of the URI represented by the JURI object.
Contents |
[edit] Syntax
string getQuery( $toArray )
where:
| Argument | Data type | Description | Default |
|---|---|---|---|
| $toArray | Boolean | If true then the query items are returned as an associative array; otherwise they are returned as a string. | false |
[edit] Example 1
In this example, the query part of the URI represented by the URI object is returned as a string.
$uri = 'http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthis'; $u =& JURI::getInstance( $uri ); echo 'Query is ' . $u->getQuery();
would output
Query is task=view&id=32
[edit] Example 2
In this example, the query part of the URI represented by the URI object is returned as an array of query items.
$uri = 'http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthis'; $u =& JURI::getInstance( $uri ); print_r( $u->getQuery( true ) );
would output
Array
(
[task] => view
[id] => 32
)