加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – CodeIgniter – 从URL中删除“索引”

发布时间:2020-12-13 18:04:31 所属栏目:PHP教程 来源:网络整理
导读:NOTE: I’m not talking about removing index.php – I mean index – the method name. 我当前的网址如下所示: www.mysite.com/view-topic/index/my-topic 这就是我想要的样子: wwww.mysite.com/view-topic/my-topic 我该怎么做呢? 提前致谢! 您可以为

NOTE: I’m not talking about removing index.php – I mean index – the method name.

我当前的网址如下所示:

www.mysite.com/view-topic/index/my-topic

这就是我想要的样子:

wwww.mysite.com/view-topic/my-topic

我该怎么做呢?

提前致谢!

您可以为此设置路由,在application / config / routes.php中添加一个新行:
$route['view-topic/(:any)'] = 'view-topic/index/$1';

这将路由您的URL http://url.com/view-topic/anythinggoeshere将屏蔽view-topic / index / anythinggoeshere控制器.

有关路由的更多信息:

> Routing with Codeigniter

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读