kevin0171 发表于 2011-7-15 16:50:11

新手的 问题,关于报错的

<?php
                class Insert extends __Construt{
                                function insert(){
                                                parent::Controller();
                                                $this->load->database();
                                        }
                                function index(){
                                                $this->load->view('insertnewsView');
                                        }
                                functioninsertnews(){
                                                $data=array(
                                                                                'username'=>$_POST['username'],
                                                                                'password'=>$_POST['password'],
                                                                               
                                                                        );
                                                $this->load->model('insertModel');
                                                $this->insertModel->insert($data);
                                                echo "插入数据成功";
                                        }
                        }
        ?>



这是我的代码为什么检测运行的时候报错:Fatal error: Call to undefined method CI_Controller::controller() in D:\AppServ\www\mykingdom\application\controllers\insert.php on line 6
求帮忙

jeongee 发表于 2011-7-15 16:58:14

本帖最后由 jeongee 于 2011-7-15 16:58 编辑

class Insert extends __Construt{
这是什么东西
CI2.0以上这样写
extends CI_Controller{

    function __construct(){parent::__construct();}
}
2.0之前的这样写
extends Controller{

    function __construct(){parent::__Controller();}
}

PS:好好看下PHP的基础

kevin0171 发表于 2011-7-15 17:17:06

必须的谢谢,

lamtin 发表于 2011-7-15 23:18:29

LZ连基础也没打好~这么快就上框架啦~
页: [1]
查看完整版本: 新手的 问题,关于报错的