JURI/setHost
From Joomla! Documentation
< JURI(Difference between revisions)
(New page: Sets the host part of the URI represented by the JURI object. ===Syntax=== void setHost( $host ) where: {| class="wikitable" !Argument !Data type !Description !Default |- |$host |string |...) |
m (→See also: re-categorisation) |
||
| Line 30: | Line 30: | ||
* [http://api.joomla.org/Joomla-Framework/Environment/JURI.html#setHost JURI->setHost on api.joomla.org] | * [http://api.joomla.org/Joomla-Framework/Environment/JURI.html#setHost JURI->setHost on api.joomla.org] | ||
* [[JURI/getHost|JURI->getHost]] | * [[JURI/getHost|JURI->getHost]] | ||
| − | <noinclude> | + | <noinclude>[[Category:JURI]]</noinclude> |
Latest revision as of 12:42, 9 August 2012
Sets the host part of the URI represented by the JURI object.
[edit] Syntax
void setHost( $host )
where:
| Argument | Data type | Description | Default |
|---|---|---|---|
| $host | string | Host name or IP address to be added to the URI. This will replace any existing host name or IP address. |
[edit] Example
In this example, a URI object is created and the host is then changed.
$uri = 'http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthis'; $u =& JURI::getInstance( $uri ); echo 'Before: ' . $u->toString() . "\n"; $u->setHost( 'www.joomla.org' ); echo 'After : ' . $u->toString();
would output
Before: http://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthat After : http://fredbloggs:itsasecret@www.joomla.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthat