yii数据库查询
Yii框架基础篇->第五章 数据模型-> 5-3单表查询 视频 10:53秒处。
这里
$results=test::find()->where(['id'=>1])->all();
并没有设置查询哪张数据表,但是还是查询出了test数据表中的相应字段
附查询结果:
Array ( [0] => app\models\test Object ( [_attributes:yii\db\BaseActiveRecord:private] => Array ( [id] => 1 [title] => title1 ) [_oldAttributes:yii\db\BaseActiveRecord:private] => Array ( [id] => 1 [title] => title1 ) [_related:yii\db\BaseActiveRecord:private] => Array ( ) [_errors:yii\base\Model:private] => [_validators:yii\base\Model:private] => [_scenario:yii\base\Model:private] => default [_events:yii\base\Component:private] => Array ( ) [_behaviors:yii\base\Component:private] => Array ( ) ) )