update readme
This commit is contained in:
parent
61bdba5ad4
commit
942928aa05
1 changed files with 9 additions and 9 deletions
10
README.md
10
README.md
|
@ -1,9 +1,9 @@
|
||||||
R2
|
R2
|
||||||
================
|
================
|
||||||
|
|
||||||
libr2 is a DFA URI router library. It compiles your route paths into DFA state
|
libr2 is an URI router library. It compiles your route paths into a radix tree.
|
||||||
table, and you may dispatch the URL based on the transition table in C.
|
By using the constructed radix tree in the start-up time, you may dispatch your
|
||||||
|
routes efficiently.
|
||||||
|
|
||||||
|
|
||||||
Pattern Syntax
|
Pattern Syntax
|
||||||
|
@ -26,8 +26,8 @@ $paths = [
|
||||||
'/blog/post' => [ 'controller' => 'PostController' , 'action' => 'create' , 'method' => 'POST' ] ,
|
'/blog/post' => [ 'controller' => 'PostController' , 'action' => 'create' , 'method' => 'POST' ] ,
|
||||||
'/blog' => [ 'controller' => 'BlogController' , 'action' => 'list' , 'method' => 'GET' ] ,
|
'/blog' => [ 'controller' => 'BlogController' , 'action' => 'list' , 'method' => 'GET' ] ,
|
||||||
];
|
];
|
||||||
$rs = r2_compile($paths, 'persisten-table-id');
|
$rs = r2_compile_radix($paths, 'persisten-table-id');
|
||||||
$ret = r2_dispatch($rs, '/blog/post/3' );
|
$ret = r2_dispatch_radix($rs, '/blog/post/3' );
|
||||||
list($complete, $route, $variables) = $ret;
|
list($complete, $route, $variables) = $ret;
|
||||||
|
|
||||||
list($error, $message) = r2_validate($route); // validate route conditions
|
list($error, $message) = r2_validate($route); // validate route conditions
|
||||||
|
|
Loading…
Reference in a new issue