Codeigniter 语法说明 uri_segment
Codeignither Syntax Explanation uri_segment
有人可以向我解释一下这个语法 $this->uri->segment(3);
它在 Codeignither 中的用途和相关性。
$this->uri->segment(n);
用于获取 url 的某些部分,这在某些情况下非常方便。其中之一可能是:
如果你有这样的url
:
http://example.com/users/profile/1
你可以这样做:
$this->uri->segment(3); //the third segment starting from /users so counting begin after the domain name
为了获取传递的配置文件 ID 并在您的控制器或模型中使用它
有人可以向我解释一下这个语法 $this->uri->segment(3);
它在 Codeignither 中的用途和相关性。
$this->uri->segment(n);
用于获取 url 的某些部分,这在某些情况下非常方便。其中之一可能是:
如果你有这样的url
:
http://example.com/users/profile/1
你可以这样做:
$this->uri->segment(3); //the third segment starting from /users so counting begin after the domain name
为了获取传递的配置文件 ID 并在您的控制器或模型中使用它