Dynamic URLs
Using placeholders to create dynamic routes
Route Placeholders
Router::add_route('GET', '/user/{name}', [HomeController::class, 'show']);class HomeController {
public function show($request) {
VIEW::init('index.html');
}<h1> Hello, <?= $name; ?> </h1>Hello, shoaib- /user/admin # this one is more specific as there are no placeholders.
- /user/{name} # this one is less specific and should be placed after first oneAdding Multiple Placeholders
Last updated