我现在像这样在我的 codeigniter 配置中设置 uri 路由
$route['user/:any'] = "users";
像这样的请求一切正常
http://localhost/user/1
但如果我尝试请求
http://localhost/user/
所以uri段是空的,我收到错误
404 Page Not Found
The page you requested was not found.
如何避免这种情况?我试过用
$user = $this->uri->segment(2);
if (!isset($user)) redirect('/', 'refresh');
但这不起作用。