我当前的URL是
http://localhost/news/user/user_profile/16
http://localhost/news=是基本url
/user/=是控制器名称
user_profile=是函数名
这是链接
<a href="<?php echo base_url().'user/user_profile/'.$id;?>" class="btn btn-default btn-flat">Profile</a>
16=是用户id
我想从URL 中删除用户id
所以我想要我的URL像这个
http://localhost/news/user/user_profile
请帮忙。。。。。。
这取决于您的使用方式。
如果您想显示自己的配置文件或已登录的用户配置文件。您可以使用该链接。http://localhost/news/user/user_profile其中id将是将在会话中记录的用户id。。
在其他情况下,如果你想显示其他用户的个人资料,如facebook个人资料。你必须在url中获取id或slug。这是最好的方法。
http://localhost/news/user/user_profile/(id)或http://localhost/news/user/user_profile/(段塞名称)或
你仍然需要有类似的urlhttp://localhost/news/user/user_profile/这意味着你必须为每个链接使用表单,为每个请求提交表单,并采用id作为发布方法,我不推荐这种方式。