PHP Classes

File: documentor/advanced.php

Recommend this page to a friend!
  Classes of Mark Rolich   PHP URL Router Class   documentor/advanced.php   Download  
File: documentor/advanced.php
Role: Example script
Content type: text/plain
Description: Documention generator files
Class: PHP URL Router Class
Match URLs with routes for controllers and actions
Author: By
Last change: Update of documentor/advanced.php
Date: 2 months ago
Size: 534 bytes
 

Contents

Class file image Download
<?php
$router
= new Bike\Router();

$router->addToken('y', '[0-9]{4}');
$router->addToken('m', '[0-9]{2}');
$router->addToken('d', '[0-9]{2}');

$router->add('article-with-date-and-slug',
    array(
       
'method' => 'GET, POST',
       
'route' => '(/controller)(/action(.~format))(/y-m-d(/^slug))',
       
'defaults' => array(
           
'controller' => 'index',
           
'action' => 'index',
           
'format' => 'html'
       
)
    )
);

$result = $router->match('GET', '/articles/2009-01-01/some-slug-for-article');
?>