gpt4 book ai didi

php - CodeIgniter:如何获取Controller、Action、URL信息

转载 作者:行者123 更新时间:2023-12-01 17:00:32 24 4
gpt4 key购买 nike

我有这些网址:

如何从这些 URL 获取 Controller 名称、操作名称。我是 CodeIgniter 新手。是否有任何辅助函数可以获取此信息

例如:

$params = helper_function( current_url() )

其中 $params 变成类似

array (
'controller' => 'system/settings',
'action' => 'edit',
'...'=>'...'
)

最佳答案

您可以使用URI Class :

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

我还被告知以下工作有效,但目前无法测试:

$this->router->fetch_class();
$this->router->fetch_method();

关于php - CodeIgniter:如何获取Controller、Action、URL信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2062086/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com