Ste*_*eph 4 php oop model codeigniter
我正在尝试编写自己的MY_Model基类,但我遇到了一个奇怪的问题:
/core/MY_Model.php
function __construct() {
if ( !empty($this->table)) {
// query db, etc.
}
else {
// even though that I set $this->table value
// in the child class, I always ended up here
// it's always empty!!!!
log_message('error', 'some error message');
}
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
/models/test_model.php
function __construct() {
parent::__construct();
}
// ...
}
Run Code Online (Sandbox Code Playgroud)
即使我在子类中设置$ this-> table值,我总是在MY_Model类中找到$ table value为空,它总是空的!有什么提示吗?!