请有人向我解释一下这个语法$this->uri->segment(3);在Codeignither中的用法和相关性。
发布于 2016-10-06 22:08:25
$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,并将其用于控制器或模型中。
https://stackoverflow.com/questions/39906234
复制相似问题