xuanyan/router

此包最新版本(dev-master)没有可用的许可信息。

dev-master 2015-08-11 03:55 UTC

This package is not auto-updated.

Last update: 2024-09-23 12:06:21 UTC


README

Build Status

如何使用它

require_once __DIR__ . '/src/Router.php';

use XuanYan\Router as Router;

$router = new Router(__DIR__ . '/Controllers');

// set blog module
// handle url like: http://example.com/blog/controller/action, it was a rewrite url

$router->setModule('blog', __DIR__ . '/Blog/Controllers');


// map blog/xuanyan  to blogdb/xuanyan
$router->map('blog/:username', 'blogdb/:username');
// if u just want to handler the number you could use :NUM
$router->map('user/:NUM/profile', 'user/profile/:NUM');


// run router
// handle url like: http://example.com/?url=controller/action
// sure, u can use rewrite to let the url seems better
$router->run(@$_GET['url']);