Class Pinoco_Router
Pattern matching router. This utility can be used on any phase of Pinoco runtime process.
$router = Pinoco::instance()->route(); $router->pass(array('', 'index.html',)) ->on('list', function() use($self, $data) { // ... }) ->on('show/{id}', function($id) use($self, $data) { // ... }) ->on('POST:post', function() use($self, $data) { // ... }) ->on('GET:post', array($this, 'forbidden')) ->on('*', array($this, 'notfound'));
Pattern rules:
'/index' : Fixed route. 'index' : Fixed route in relative path from current (_enter) hook. '/show/{id}' : Parametrized one. Such path elements are passed to handler. 'GET: /edit/{id}' or 'POST: /edit/{id}' : Different HTTP methods can be different routes. '*:*' : Matches any patterns. Useful to be bound to Pinoco::notfound() or forbidden().
Package: Pinoco
Copyright: Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
License: License (http://www.opensource.org/licenses/mit-license.php)
Author: Hisateru Tanaka <tanakahisateru@gmail.com>
Located at Pinoco/Router.php
Copyright: Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
License: License (http://www.opensource.org/licenses/mit-license.php)
Author: Hisateru Tanaka <tanakahisateru@gmail.com>
Located at Pinoco/Router.php
public
|
|
public
mixed
|
|
public
mixed
|
|
public
boolean
|
protected
boolean
|
$matched |
|