This class provides static methods for easy URL manipulation.
This class provides static methods for easy URL manipulation.
static build($path, $parameters=null) [static] ¶Build a URL from the passed parameters.
You can provide a single path string, or an array of strings, in which case each of the items in $path is a path component. The path components will be concatenated, separated by slashes.
All slashes are normalized. If the first path component has a leading slash, the resulting string will also have a leading slash and if it doesn't, the resulting string won't have one either. The same goes for the trailing slash: if the last path component ends with a slash, the resulting string will have one as well.
If $parameters is passed, a HTTP query string will be appended to the url using the this associatve array.
Example:
$url = AnewtURL::join(array('/path/to', $file), array('foo' => 'bar'));
$pathSingle string or array of strings (each item is a path component of the url)
$parametersAssociative array used to build a query string (optional)
The resulting URL path
static parse($url) [static] ¶Parse a URL into a path and an array of query parameters.
This is (partly) the inverse operation of inverse AnewtURL::build() and can be used to parse an url into a path and query parameters (the GET string).
$urlstring The url to parse.
A (path, parameters) code containing a string and an associative array.