Skip to content

Url function

Andre Sieverding edited this page Aug 1, 2014 · 1 revision

(EasyRouter >= 0.7.0)

EasyRouter\main::url(string $url [, bool $relative = true [, bool $print = true ]] )

$url = The url to your ressource.

$relative = Set true, to get a relative url.

$print = Set true, to print the url.

Return values

Returns or print the prepared url.

Little example:

<?php
	// Our script works in http://www.yourwebsite.com/website
	$url = EasyRouter\main::url('image.jpg', false, false);
	$another_url = EasyRouter\main::url('image.jpg', true, false);
?>
http://www.yourwebsite.com/website/first-param/second-param will generate this:
$url = "http://www.yourwebsite.com/website/image.jpg"
$another_url = "../../image.jpg"

Clone this wiki locally