CodeIgniter - Get Last URI Segment

后端 未结 2 927
南旧
南旧 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 04:49
    $record_num = end($this->uri->segment_array());
    
    0 讨论(0)
  • 2021-02-19 05:00

    This should work:

    $last = $this->uri->total_segments();
    $record_num = $this->uri->segment($last);
    
    0 讨论(0)
提交回复
热议问题