如何添加帶有 where 條件的 orderBy()?$floor_data = Floors::find()->where(['building_id' => $id])->orderBy->(['floor_no' => SORT_DESC])->all();這給了我一個語法錯誤說語法錯誤,意外的 '(',需要標識符 (T_STRING) 或變量 (T_VARIABLE) 或 '{' 或 '$'
1 回答

炎炎設計
TA貢獻1808條經驗 獲得超4個贊
額外的->導致錯誤:
$floor_data = Floors::find()
->where(['building_id' => $id])
// Remove ↓↓
// ->orderBy->(['floor_no' => SORT_DESC])
->orderBy(['floor_no' => SORT_DESC])
->all();
- 1 回答
- 0 關注
- 146 瀏覽
添加回答
舉報
0/150
提交
取消