用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2586|回复: 3
收起左侧

[HELP] CI URL问题

[复制链接]
发表于 2011-11-17 10:28:27 | 显示全部楼层 |阅读模式
我下载安装了CI配置好了在ctrollers文件夹建了blog.php控制器,我在本地测试的,运行http://localhost/ci/index.php可以运行,但是运行http://localhost/ci/index.php/blog确找不到网页
我看网上手册说的CI默认情况下是可以的,究竟是哪里出现问题,请各位大侠指点啊,郁闷很久了
发表于 2011-11-17 10:34:05 | 显示全部楼层
你的blog controller里面建立了index method吗?
 楼主| 发表于 2011-11-17 10:37:28 | 显示全部楼层
是在哪里建立啊?
发表于 2011-11-17 13:44:29 | 显示全部楼层
本帖最后由 孤月蓝风 于 2011-11-17 13:44 编辑
逻辑 发表于 2011-11-17 10:37
是在哪里建立啊?


参考我的代码:

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');
        }
    }
 
复制代码

本版积分规则