首页 > 解决方案 > 如何从codeigniter中的url获取控制器名称?

问题描述

网址是:

https://localhost/caseTest/index.php/c_case_type_questions/master/c_case_type_questionset/id/1

我需要从上面的 url 中获取c_case_type_questions,有什么方法可以快速获取它吗?

标签: phpcodeigniter-3

解决方案


使用这个 URL 类的功能

$this->uri->segment(n); // n=1 for controller, n=2 for method, etc

有关更多详细信息,请关注此 URL

https://www.formget.com/codeigniter-uri-segment/


推荐阅读