tottyandbaty 发表于 2009-6-29 17:00:38

就加了这个东西

function __construct()
        {
                if(phpversion()<5)
                {
                        $this->Model();
                }
                else
                {
                        $this->_assign_libraries( (method_exists($this, '__get') OR method_exists($this, '__set')) ? FALSE : TRUE );
               
                        // We don't want to assign the model object to itself when using the
                        // assign_libraries function below so we'll grab the name of the model parent
                        $this->_parent_name = ucfirst(get_class($this));
                       
                        log_message('debug', "Model Class Initialized");
                }
        }

tottyandbaty 发表于 2009-6-29 17:01:52

哦,我回去检查检查

Hex 发表于 2009-6-29 17:03:08

你这样写也不应该会造成两个实例冲突吧,CI 不可能控制 PHP 的类行为。

tottyandbaty 发表于 2009-6-29 17:15:28

关于构造函数, PHP 5 在类中找不到 __construct() 函数,它就会尝试寻找旧式的构造函数,所以不用那么修改视乎也可以

Hex 发表于 2009-6-29 18:43:03

楼上说的没错,PHP5 是向下兼容的,否则就世界大乱了!呵呵

ywjrg 发表于 2009-6-30 10:29:27

楼主将子类中 $table;设为private $table;试试,public $table 在两子类中同时被使用,可能会引起冲突,后者覆盖前者。

visvoy 发表于 2009-6-30 11:02:22

用echo逐行调试吧,可能是代码哪里写混淆了
页: 1 [2]
查看完整版本: CI 的model的疑问