Ham带缓存的路由库
Ham 是一款轻量级的路由框架,利用缓存来提升速度。把任何 I/O 相关的东西缓存进 XCache/APC。要求 PHP 5.3+ 和 XCache 或者 APC。
示例代码:
require '../ham/ham.php';
$app = new Ham('example');
$app->config_from_file('settings.php');
$app->route('/pork', function($app) {
return "Delicious pork.";
});
$hello = function($app, $name='world') {
return $app->render('hello.html', array(
'name' => $name
));
};
$app->route('/hello/<string>', $hello);
$app->route('/', $hello);
$app->run();评论
