如何在codeigniter中浏览特定页面

时间:2018-09-12 05:15:08

标签: php codeigniter-3

我的管理面板侧栏如下所示

 <li class="<?= (uri_string() == 
"admin/customer_personal/listcustomerpersonal")?"active":NULL;?>">
 <a href="<?php echo 
 base_url('admin/customer_personal/listcustomerpersonal'); ?>">
 <i class="fa fa-users fa-lg"></i> View Customer Personal
  </a>
 </li>

我的视图文件位于admin / customer_personal / listcutomer.php中,然后我的控制器文件为

<?php
   if(!defined('BASEPATH')) exit('No direct script access allowed');
 class Cus_personal extends MX_Controller
{
function __construct()
{
    if($this->session->userdata('isLoggedIn')==FALSE)
    {
        redirect('auth','refresh');
    }
    //$this->load->model('model_customer_personal');
    $this->load->library('api_lib');
}
function index()
{
    $this->listcustomerpersonal();
}
function listcustomerpersonal()
{
    //$data['customers']=$this->load->get_customerall();
    //$this->theme_lib->data = $data;
    $this->theme_lib->view ='customer_personal/listcustomerpersonal';
    $this->theme_lib->title = 'D2D | Customer Attendance';
   // $this->theme_lib->pageFoot 
  ='customer_personal/listcustomerpersonalfoot';
    //$this->theme_lib->pageHead 
 ='customer_personal/listcustomerpersonalhead';
    $this->theme_lib->render();
    }
    }
   ?>

然后我的视图文件是

<?php
echo '<h1>hai hello how are you</h1>';
?>

但是我有一个错误,因为404页面未找到错误,但是此面板中的其他页面正常工作。

1 个答案:

答案 0 :(得分:0)

我想您的控制器文件也位于路径 admin / customer_personal / 中。如果是,那么您需要在行下方更改您的更改

<a href="<?php echo base_url('admin/customer_personal/listcustomerpersonal'); ?>">

<a href="<?php echo base_url('admin/customer_personal/Cus_personal/'); ?>">

希望这会有所帮助。