PHP Classes

File: test/php/test5.php

Recommend this page to a friend!
  Packages of Nikos M.   Dromeo PHP Router Library   test/php/test5.php   Download  
File: test/php/test5.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Dromeo PHP Router Library
Route HTTP requests to functions with URL patterns
Author: By
Last change:
Date: 8 months ago
Size: 584 bytes
 

Contents

Class file image Download
<?php

require(dirname(__FILE__) . '/../../src/php/Dromeo.php');

function
defaultHandler($route)
{
    echo(
'Default Handler' . PHP_EOL);
   
print_r($route);
}

$router = new Dromeo();

$router->on(array(
    array(
       
'route'=>'/????/{:user}/{:id}',
       
'name'=> 'route1',
       
'handler'=> 'defaultHandler'
   
)
));

// UTF8 BOM
define('UTF8_BOM', chr(0xEF).chr(0xBB).chr(0xBF));
echo
UTF8_BOM;

echo(
'Dromeo.VERSION = ' . Dromeo::VERSION . PHP_EOL);
echo(
PHP_EOL);

$router->route('/????/???/1', '*', true);
$router->route('/????/toyou/2', '*', true);