-
Notifications
You must be signed in to change notification settings - Fork 3
Start function
Andre Sieverding edited this page Jun 12, 2014
·
8 revisions
(EasyRouter >= 0.2.0)
EasyRouter\main::start([ string $base_directory = null [, array $parameters = null [, array $exceptions = null [, bool $load_GET = true ]]]] )$base_directory = URL to the root-directory of your website.
$parameters = Names of parameters in the URI.
$exceptions = Exceptions for parameters. If a value of a parameter not a value of an exception for this parameter, the parameter will be ignored.
$load_GET = True -> Params will be loaded in the $_GET array.
Returns an array with the uri-params on success or FALSE on failure.
<?php
$base_directory = "http://www.yourwebsite.com";
$parameters = array("language", "page");
$exceptions = array();
$exceptions[]= array(
"param" => "language",
"exceptions" => array("en", "de")
);
EasyRouter\main::start($base_directory, $parameters, $exceptions);
?>http://www.yourwebsite.com/en/user will generate this:
$_GET['language'] = 'en'
$_GET['page'] = 'user'
http://www.yourwebsite.com/user/en will generate this:
$_GET['page'] = 'user'
$_GET[1] = 'en'
http://www.yourwebsite.com/en will generate this:
$_GET['language'] = 'en'
http://www.yourwebsite.com/user will generate this:
$_GET['page'] = 'user'
http://www.yourwebsite.com/de/user?tab=contributions will generate this:
$_GET['language'] = 'de'
$_GET['page'] = 'user'
$_GET['tab'] = 'contributions'