php - 如何从codeigniter中的url获取控制器名称?
问题描述
网址是:
https://localhost/caseTest/index.php/c_case_type_questions/master/c_case_type_questionset/id/1
我需要从上面的 url 中获取c_case_type_questions,有什么方法可以快速获取它吗?
解决方案
使用这个 URL 类的功能
$this->uri->segment(n); // n=1 for controller, n=2 for method, etc
有关更多详细信息,请关注此 URL
推荐阅读
- php - 带有 wordpress 的 Ajax 脚本在我的输出中添加了一个随机的“0”
- blazor - 在 blazor 中悬停时向元素添加类
- javascript - 使用 JS 如何在文档时间轴中获取动画结束值
- python - 从装饰函数将参数传递给装饰器
- templates - 如何在自动完成 vuetify 中过滤重复的模板项
- asp.net-mvc - 从模式 asp.net mvc 在 Html.DropdownListFor 上设置选定的值
- python - 如何在sql中将数字转换为日期
- javascript - 级联选择在 Reactjs React-hook-form 中不起作用
- c++ - 如何从字符串中删除某些内容
- angularjs - 为什么我的 mwl 日历不改变语言