路由参数id为空时候跳转到上层路径,是什么原因?
Route::get('user/{id?}', function ($id = null) { //id is null , and display list of users if ($id == null) return 'User List'; //id is not null , display the user's info else return 'User-'.$id; });
访问http://localhost:8888/laravel/public/user/时候,参数为空的时候自动跳转到了http://localhost:8888/user,服务器返回:
Not Found
The requested URL /user was not found on this server.
调试环境为MAMP,请教下这是什么原因呢 和老师的演示不一样呀~谢谢