【发布时间】:2012-02-28 21:06:10
【问题描述】:
我想创建一个页面,我可以像这样浏览它:/page/5。
我创建了一个page.php 控制器,我可以查看这个页面,这是它的内容:
类页面扩展 CI_Controller {
public function __construct() { parent::__construct(); } public function index() { $this->load->view('template/header'); $id = $this->uri->segment(2); $this->load->view('template/middle', array('id' => $id)); $this->load->view('template/footer'); }}
问题是我无法从 uri 获取页码。
要明确:
这是可以访问的:index.php/page。
但在这个网址,我得到的是 404:index.php/page/5
我知道我可以创建另一个控制器函数来查看像 /index.php/page/id/5 这样的页面,但我希望它可以通过索引函数访问。
这可能吗?
【问题讨论】:
标签: codeigniter uri