public function __construct($name='',$tablePrefix='',$connection='') {
// 模型初始化
$this->_initialize();
// 获取模型名称
if(!empty($name)) {
if(strpos($name,'.')) { // 支持 数据库名.模型名的 定义
list($this->dbName,$this->name) = explode('.',$name);
}else{
$this->name = $name;
}
}elseif(empty($this->name)){
$this->name = $this->getModelName();
}
// 设置表前缀
if(is_null($tablePrefix)) {// 前缀为Null表示没有前缀
$this->tablePrefix = '';
}elseif('' != $tablePrefix) {
$this->tablePrefix = $tablePrefix;
}else{
$this->tablePrefix = $this->tablePrefix?$this->tablePrefix:C('DB_PREFIX');
}
if(is_null($tablePrefix)) 这里,这里永远是假啊因为即使不提供前缀,默认值空字符串也不是null,所以这局话没用啊,是我理解错了还是就是错的 最佳答案
