我的模型FAQ有4个属性
原文链接:https://www.f2er.com/php/137693.html* @property integer $id
* @property string $chapter
* @property string $question
* @property string $answer
现在我的actionIndex函数看起来像
public function actionIndex() { $faq = Faq::find()->all(); $dataProvider = new ActiveDataProvider([ 'query' => Faq::find(),]); return $this->render('index',[ 'dataProvider' => $dataProvider,'faq' => $faq ]); }
如何在Controller中使用Yii2或PHP获取$chapter的唯一值数组?让我们说在sql看起来像
SELECT DISTINCT chapter FROM’faq_table’