我是在自己电脑上搭建的PHP环境
如果把$this->_db=M('admin');不放在析构函数中,放到getAdminByUsername却正确运行?有人遇到没?
class AdminModel extends Model{
private $_db = '';
public function _construct(){
$this->_db=M('admin');
}
public function getAdminByUsername($username){
$ret = $this->_db->where('username = "'.$username.'"')->find();
return $ret;
}
}