phprouter / main

Secure router with XSS and CSRF
MIT License
514 stars 143 forks source link

Callback on dynamic route #33

Closed Orio-nn closed 2 years ago

Orio-nn commented 2 years ago

Callbacks don't pass the parameters in a dynamic route. Don't know if this is a bug or an unimplemented feature, either way it is an issue. Take the snippet below (crudely written, apologize for any syntax errors)

get('/user/$user' function($id) {
    // your code here n stuff
});
phprouter commented 2 years ago

This has been fixed. Now this works:

get('/callback/$name', function($name){ echo "Callback executed. The name is $name"; });