目前我的网站网址是 https://www.thefoolsbookie.com/main/inside?id=8 但我希望这就像这样 https://www.thefoolsbookie.com/nfl 我怎么能这样做?
答案 0 :(得分:0)
编辑application / config / routes.php文件并为其添加新路由
$route['nfl'] = 'main/inside';
应该如此简单:)
有关更多示例,请参阅https://ellislab.com/codeigniter/user-guide/general/routing.html。
我已经和CI一起工作了很长时间,而且我从未见过它以这种方式在路径文件中使用GET参数。我不确定是否有可能。
你可以像$route['nfl'] = 'main/inside/8';
然后在主控制器中你的内部方法看起来像:
public function inside($id)
{
//$id would contain the ID of 8 when you go to
//https://www.thefoolsbookie.com/main/inside/8
//or https://www.thefoolsbookie.com/nfl
}