[英]Code igniter url segment
目前,我的网站网址是https://www.thefoolsbookie.com/main/inside?id=8,但我希望它像这样https://www.thefoolsbookie.com/nfl我该怎么做?
编辑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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.