PHP Classes

File: documentor/optional_parameters_with_defaults.php

Recommend this page to a friend!
  Classes of Mark Rolich   PHP URL Router Class   documentor/optional_parameters_with_defaults.php   Download  
File: documentor/optional_parameters_with_defaults.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/optional_parameters_with_defaults.php
Date: 4 months ago
Size: 388 bytes
 

Contents

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

$router->add('optional-controller-and-action-with-defaults',
    array(
       
'method' => 'GET, POST',
       
'route' => '/(controller(/action))',
       
'defaults' => array(
           
'controller' => 'index',
           
'action' => 'index'
       
)
    )
);

$result1 = $router->match('GET', '/news');
$result2 = $router->match('GET', '/');
?>