mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-07-07 10:03:39 +02:00
add example for url generation to readme
This commit is contained in:
@ -9,11 +9,14 @@ $router->map( 'GET', '/', function() {
|
||||
require __DIR__ . '/views/home.php';
|
||||
});
|
||||
|
||||
// map users details page
|
||||
// dynamic named route
|
||||
$router->map( 'GET|POST', '/users/[i:id]/', function( $id ) {
|
||||
$user = .....
|
||||
require __DIR__ . '/views/user/details.php';
|
||||
});
|
||||
}, 'user-details' );
|
||||
|
||||
// echo URL to user-details page for ID 5
|
||||
echo $router->generate( 'user-details', array( 'id' => 5 ) ); // Output: "/users/5"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
Reference in New Issue
Block a user