Php 在CodeIgniter中找不到包含slug的错误页面
当我使用slug实现URL时,找不到错误页面 这是控制器中的代码Php 在CodeIgniter中找不到包含slug的错误页面,php,codeigniter,Php,Codeigniter,当我使用slug实现URL时,找不到错误页面 这是控制器中的代码 function view($slug) { $this->data['halaman_item'] = $this->mhalaman->get_profil($slug); if (empty($this->data['halaman_item'])) { show_404(); } $this->data['title'] = $this-&g
function view($slug)
{
$this->data['halaman_item'] = $this->mhalaman->get_profil($slug);
if (empty($this->data['halaman_item'])) {
show_404();
}
$this->data['title'] = $this->data['halaman_item']['judul']; $this->data['orang'] = $this->mlogin->dataPengguna($this->session->userdata('username'));
$this->data['contents'] = $this->load->view('mahasiswa/profil/sejarah', $this->data, true);
$this->load->view('template/wrapper/mahasiswa/wrapper_content',$this->data);
}
模型
路线
当我运行这个链接时,tkd/index.php/mahasiswa/profil/sejarah
is 404页找不到。也许你知道问题在哪里
帮我做什么。谢谢。好吧,在不知道你的应用程序的其余部分有多少工作的情况下…第一件显而易见的事情是确保
$this->data['halaman\u item']
中确实有数据…因为如果没有,它会在任何事情发生之前调用show\u 404
function get_profil($slug = FALSE)
{
if ($slug === FALSE)
{
$query = $this->db->get($this->tbl_halaman);
return $query->result_array();
}
$query = $this->db->get_where($this->tbl_halaman, array('slug'=>$slug));
return $query->row_array();
}
$route['profil/view'] = "profil/view";
$route['profil/(:any)'] = "profil/view/$1";
$route['profil'] = "profil";