LitePHP是一个简单, 轻量, 快速, 可扩展的框架.它可以让快速的建一个REST风格的应用程序.
require 'lite/Lite.php';
$app = new lite\App();
$app->addRoute('/', function(){
$body = "<h4>hello world!</h4>";
return $body;
});
$app->addRoute('/@name/@id', function($name, $id){
echo "hello, $name ($id)!";
});
$app->run();
LitePHP 需要PHP5.4以上
MIT license许可.
下载litePHP安装包
Apache*, 可以如下配置:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
对于 Nginx:
server {
location / {
if (!-e $request_filename ) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
}