2013-02-17 80 views
-1

找遍周围的例子,但我得到一个奇怪的结果笨URI不工作 - 404错误

我想有以下发生/页/ 1 URL从数据库中返回第1行的标记列的页表。

控制器

 

    public function index() 
     { 
      $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'); 
     } 

模型

 

    public function specificMarkup($id) 

     { 
     $query = $this->db->get_where('pages', $id); 
     $row = $query->row(); 
     return $row->markup; 
     } 

当我专门设置的$ id,但现在当我尝试使用部分返回404错误它的工作原理,用户指南给我的感觉这应该工作。

回答

0

我会为其他人遇到的问题回答我自己的问题。

1.

的模型需要

public function specificMarkup($id) 

    { 
    $query = $this->db->get_where('pages', array('id' => $id)); 
    $row = $query->row(); 
    return $row->markup; 
    } 

2. 他们确实需要在routes.php文件中的条目

$路线[“页/(:NUM )'] ='网页/索引/ $ 1'

这是如此codeigniter知道在哪里指导交通