1
我在yii2中爲用戶創建了rest api。我可以訪問像「api/web/v1/users」這樣的用戶列表,但問題是它提供的所有列的數據包括密碼,我在yii2文檔中看到它在內部調用「user/index」方法,有沒有什麼辦法可以覆蓋索引這樣的方法?覆蓋Yii2中的默認靜止動作
class UserController extends ActiveController {
public $modelClass = 'common\models\User';
public function actionIndex(){
//return selected columns here of the user table
}
}
它仍然給所有用戶列表,我不想要的所有列。請幫忙。