0
我已經添加到文章頁面的刪除鏈接,但是當我點擊刪除,在URL中它說.......... index.php/news/delet1它挑選出ID,但出現了404錯誤。codeigniter刪除404錯誤
控制器news.php
public function delete($id){
$id = $this->uri->segment(3);
$data['title'] = 'Delete an item';
if($this->news_model->delete_news($id)){
$this->load->view('templates/header', $data);
$this->load->view('news/success');
$this->load->view('templates/footer');
}
}
view.php
<p><a href="news/delete<?php echo $news_item['id'] ?>">delete article</a></p>
news_model.php
public function delete_news($id){
$this->db->where('id',$id)->delete('news');
return $this->db->affected_rows();
}
路線
$route['news/delete/(:num)'] = 'news/delete/$1';
幫助,將不勝感激。
非常感謝你現在的工作。 – tom 2013-03-09 20:38:04
@ user2152113 - 請將答案標記爲已接受。 – mcryan 2013-03-09 20:39:16
剩下2分鐘時間將結束 – tom 2013-03-09 20:44:48