|
发表于 2011-11-17 13:44:29
|
显示全部楼层
本帖最后由 孤月蓝风 于 2011-11-17 13:44 编辑
逻辑 发表于 2011-11-17 10:37 ![](static/image/common/back.gif)
是在哪里建立啊?
参考我的代码:
PHP复制代码
class Contact extends CI_Controller {
//主方法,用于显示主页
function __construct ()
{
parent ::__construct ();
//设置全局编码
header('Content-Type: text/html; charset=utf-8');
//加载数据库
$this->load->database();
//加载辅助函数
$this->load->helper('url');
$this->load->helper('form');
//加载类库
$this->load->library('session');
//全局加载模型
$this->load->model('model_contact');
}
function index ()
{
if (!$this->session->userdata('admin'))
{
redirect (site_url ().'/home/login');
}
else
{
$data['person'] = $this->model_contact->get_person();
$data['id'] = 1;
$this->load->view('header');
$this->load->view('contact_show',$data);
$this->load->view('contact_add');
$this->load->view('footer');
}
}
复制代码 |
|