PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Luis Toscano   Kompat PHP Router Library   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Kompat PHP Router Library
Route HTTP requests to classes or functions
Author: By
Last change:
Date: 5 years ago
Size: 421 bytes
 

Contents

Class file image Download
<?php

ini_set
('display_errors',1);

include
'core/model.class.php';
include
'router.php';

$r = new Router();

$r->add('/articulos/?', function($id){
    echo
'articulo #'.$id;
});

$r->add('/carro/?', '@models/carros/get');


echo
'<pre>';
$r->group('/api', function($rr){
    GLOBAL
$r;

   
$r->add('/usuario/?', function($id){
        echo
$id;
    });

   
$r->add('/carros', '@models/carros');

},[
'needToken' => true]);
echo
'</pre>';