且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Yii2:Ajax调用多个参数

更新时间:2022-01-28 07:34:48

您可以像下面这样获得这个参数:

You can get this param like below:

public function actionChargesCash($id,$room_category){
    $model = \app\models\IpdCharges::findOne(['id'=>$id,'room_category'=>$room_category]);
    //rest of code
}

还有另一种方法可以做到这一点:

There is another way to do that:

public function actionChargesCash($id){
    $room_category=Yii::$app->getRequest()->getQueryParam('room_category');
    $model = \app\models\IpdCharges::findOne(['id'=>$id,'room_category'=>$room_category]);
    //rest of code
}