Location: PHPKode > projects > epiphany-PHP Framework > jmathai-epiphany-7cd7e0c/examples/regex-route/index.php
<?php
chdir('..');
include_once '../src/Epi.php';
Epi::setPath('base', '../src');
Epi::init('route');

/*
 * This file is an example of using regular expressions in a route.
 * You can use subpatterns which are passed to the function as parameters.
 */
$router = new EpiRoute();
$router->get('/', 'home');
$router->get('/(\w+)/(\w+)', 'greeting');
$router->run(); 

/*
 * ******************************************************************************************
 * Define functions and classes which are executed by EpiRoute
 * ******************************************************************************************
 */
function home()
{
  echo '<h1>Home page. <a href="jaisen/mathai">Click for greeting</a></h1>';
}

function greeting($firstName, $lastName)
{
  echo "<h1>Welcome, {$firstName} {$lastName}</h1>";
}
Return current item: epiphany-PHP Framework