CodeIgniter - Get Last URI Segment

后端 未结 2 929
南旧
南旧 2021-02-19 04:44

I\'m trying to get the last URI segment in CI, however I don\'t know what the number for it will be, as parameters (an integer) will be appended as the user clicks links within

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 05:00

    This should work:

    $last = $this->uri->total_segments();
    $record_num = $this->uri->segment($last);
    

提交回复
热议问题