Controller::::::
$user = User::findOne(['ID'=>Yii::$app->user->getId()]);
dd($user->toArray());
Model::::::::::
public function fields()
{ $fields = parent::fields();// 加入一些字段 $fields['aaaa'] = 'ID'; $fields['bbbb'] = function (){ return $this->BANK_ADDRESS.$this->OPEN_BANK; }; $fields['cccc'] = function (){ return $this->ID.'這是個啥?'; }; // 去掉一些包含敏感信息的字段 unset($fields['USER_NAME']); unset($fields['PASSWORD_HASH']); unset($fields['PAY_PASSWORD']);// unset($fields['auth_key'], $fields['password_hash'], $fields['password_reset_token']); return $fields; }