yii 之删除数据

  public function actionTest(){
        //删除

        //方法一
        $result = Test::find()->where(['id' => 1])->all();
        $result[0]->delete();

        //方法二
        Test::deleteAll('id>:id', array(':id' => 5));
    }

猜你喜欢

转载自www.cnblogs.com/gyfluck/p/9101128.html
yii