JURI/setScheme
From Joomla! Documentation
Sets the scheme part of the URI represented by the JURI object.
Syntax
void setScheme( $scheme )
where:
| Argument | Data type | Description | Default |
|---|---|---|---|
| $scheme | string | Scheme to be added to the URI. This will replace any existing scheme. |
Example
In this example, a URI object is created and the scheme 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->setScheme( 'https' ); 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 : https://fredbloggs:itsasecret@www.example.com:8080/path/to/Joomla/index.php?task=view&id=32#anchorthat