Ejemplo n.º 1
0
Archivo: index.php Proyecto: c9s/roller
    {
        $put = $this->parseInput();
        return $put;
        // return array( 'id' => $id );
    }
    public function delete($resource, $id)
    {
        $args = $this->parseInput();
        // print_r($args);
        return array('id' => $id);
    }
    public function find($resource)
    {
        return range(1, 10);
    }
}
$router = new Roller\Router(null, array('cache_id' => 'router_demo'));
$restful = new Roller\Plugin\RESTful(array('prefix' => '/='));
$restful->setGenericHandler('MyGenericHandler');
$router->addPlugin($restful);
# foreach( range(1,100) as $i )
#     $router->add("/foo$i" , function() {  return 'true'; });
$router->add('/', function () {
    return 'Hello World, please request /=/test for RESTful resource handler demo.';
});
$r = $router->dispatch(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/');
if ($r) {
    echo $r();
} else {
    die('Page not found');
}