CodeIgniter-获取最后一个URI段 [英] CodeIgniter - Get Last URI Segment

查看:65
本文介绍了CodeIgniter-获取最后一个URI段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取CI中的最后一个URI分段,但是我不知道它的数字,因为当用户单击页面内的链接时,将附加参数(整数)。然后在控制器中使用它们,通过ajax将相关的数据库记录拉入页面。

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 the page. These are then used in a controller to pull relevant database records into the page via ajax.

我如何告诉CI获取最后一个段?

How can I tell CI to get the last segment?

类似的东西:

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


推荐答案

$record_num = end($this->uri->segment_array());

这篇关于CodeIgniter-获取最后一个URI段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆