我已经四处寻找示例,但我得到了一个奇怪的结果
我希望有以下发生 /pages/1 URL 从数据库返回页表的第 1 行的标记列。
控制器
公共函数索引()
{
$id = $this->uri->segment(2);
$content = $this->page->specificMarkup($id);
$this->template->set('nav', 'support');
$this->template->set('content', $content);
$this->template->load('master', 'contact');
}
模型
公共功能特定标记($id)
{
$query = $this->db->get_where('pages', $id);
$row = $query->row();
返回$行->标记;
}
它在我专门设置 $id 时有效,但现在当我尝试使用段时返回 404 错误,用户指南给我的印象是这应该有效。