逻辑 发表于 2011-11-17 10:28:27

CI URL问题

我下载安装了CI配置好了在ctrollers文件夹建了blog.php控制器,我在本地测试的,运行http://localhost/ci/index.php可以运行,但是运行http://localhost/ci/index.php/blog确找不到网页
我看网上手册说的CI默认情况下是可以的,究竟是哪里出现问题,请各位大侠指点啊,郁闷很久了

zfm1988 发表于 2011-11-17 10:34:05

你的blog controller里面建立了index method吗?{:1_1:}{:1_1:}

逻辑 发表于 2011-11-17 10:37:28

是在哪里建立啊?

孤月蓝风 发表于 2011-11-17 13:44:29

本帖最后由 孤月蓝风 于 2011-11-17 13:44 编辑

逻辑 发表于 2011-11-17 10:37 static/image/common/back.gif
是在哪里建立啊?

参考我的代码:


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');
      }
    }
页: [1]
查看完整版本: CI URL问题