PHP Classes

File: documentor/method_not_supported.php

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

Contents

Class file image Download
<?php
use Bike\Router;
use
Bike\RouterException;

try {
   
$router = new Router();

   
$router->add('controller-only',
        array(
           
'method' => 'GET, TEST',
           
'route' => '/controller'
       
)
    );

   
$result = $router->match('GET', '/news');
} catch (
RouterException $e) {
    if (
$e->getCode() === 1) {
       
$result = $e->getMessage();
    }
}

// output: 'Method TEST is not supported'
?>