Laravel: Routing parameters not working

Michal

I have laravel on localhost/laravel/public. I am trying set routes but this always generate 404 error on url localhost/laravel/public/user/John/[email protected]:

Route::get('user/{name}/{mail}', function($name, $mail)
{
    return "User $name : $mail";
});

and this work on url localhost/laravel/public/test/John/[email protected]

Route::get('test/(:any)/(:any)', function($name, $mail)
{
    return "Test $name : $mail";
});
Tom

If you are using L3 (third version of Laravel) then your second way to handle routes is correct.

Routing with parameters in {} like so:

Route::get('user/{name}/{mail}', function($name, $mail)

won't work as it was introduced in Laravel 4.

Read more about routing in L3 in here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related