Skip to content

Execute function

Andre Sieverding edited this page Jun 12, 2014 · 4 revisions

(EasyRouter >= 0.3.0)

EasyRouter\main::execute([ string $base_directory = null [, bool $load_GET = true ]] )

$base_directory = URL to the root-directory of your website.

$load_GET = True -> Params will be loaded in the $_GET array.

Return values

Returns an array with the uri-params on success or FALSE on failure.

Little example with prepare pattern:

<?php
	$base_directory = "http://www.yourwebsite.com";
	EasyRouter\main::prepare("{language}/{id}-{page}/{subpage}"); // before you execute the routing system, you have to prepare the route pattern
	EasyRouter\main::execute($base_directory);
?>
http://www.yourwebsite.com/en/21-customers/new will generate this:
$_GET['language'] = 'en'
$_GET['id'] = '21'
$_GET['page'] = 'customers'
$_GET['subpage'] = 'new'

http://www.yourwebsite.com/de/21-customers will generate this:
$_GET['language'] = 'de'
$_GET['id'] = '21'
$_GET['page'] = 'customers'

http://www.yourwebsite.com/en/21-customers/new/param1/param2 will generate this:
$_GET['language'] = 'en'
$_GET['id'] = '21'
$_GET['page'] = 'customers'
$_GET['subpage'] = 'new'
$_GET[4] = 'param1'
$_GET[5] = 'param2'

Clone this wiki locally