codeigniter我的删除不知道是不能传参还是路由问题
路由是这样的
PHP复制代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$route['default_controller'] = 'pages/view';
$route['content/(:any)'] = 'content/view/$1';
$route['content'] = 'content';
$route['content/del/(:any)'] = 'content/del/$1';
$route['content/add'] = 'content/add';
$route['(:any)'] = 'pages/view/$1';
$route['404_override'] = '';
复制代码
控制器是这样的
PHP复制代码
<?phpclass Content extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('content_model');
}
public function index()
{
$data['title'] = 'Content archive';
$data['content'] = $this->content_model->get_content();
$this->load->view('templates/header', $data);
$this->load->view('content/index', $data);
$this->load->view('templates/footer');
}
public function view($slug)
{
$data['content_item'] = $this->content_model->get_content($slug);
if (empty($data['content_item']))
{
show_404();
}
$data['title'] = $data['content_item']['title'];
$this->load->view('templates/header', $data);
&nbs