kongge/xxx

..


Keywords
restful, router
License
MIT

Documentation

xxxPHP


demo

require("./vendor/autoload.php");
$xxx = XXX\xxx::getInstance($option);

$xxx->on('#^[/]{0,1}$#', function(){

    $this->send('<html><head><title>xxxPHP</title></head><body><h1>hello, world!</h1></body></html>');die;

})->on('#^/(article|user|role)/read/(\d+)$#', function($table, $id){

    $resp = $this->fetchRow("SELECT * FROM `{$table}` WHERE `id`='{$id}' LIMIT 1") OR $this->message(1, '请求的数据不存在');
    if($table == 'article') $resp['content'] = stripslashes($resp['content']);
    $this->message(0, $resp);

})->on...