To get last URI segment using Codeigniter use this code.
<?php end($this->uri->segments) ?>
For example if you want to check that if last URI segment is exist or not.
Follow this example code:
<?php $las_segment = end($this->uri->segments); if($las_segment=="my-url-name"){ // Your code here }else{ // Your code here } ?>
Question and answer is powered by AnsPress.io