Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在CodeIgniter中找不到包含slug的错误页面_Php_Codeigniter - Fatal编程技术网

Php 在CodeIgniter中找不到包含slug的错误页面

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

当我使用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->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";