public function newResourcePriceAction() { $resourceNum = (int) $this->get('resourceNum'); $schoolId = (int) $this->get('schoolId'); $resourcePrice = []; for ($i = 0; $i <= $resourceNum; $i++) { $priceNotFree = $this->get('priceType' . $i); //print_r('priceType'.$i."notFree:".$priceNotFree." "); $price = $this->get('price' . $i, 0); //print_r("price:".$price." "); $resourceId = (int) substr($priceNotFree, 1); $notFree = (int) substr($priceNotFree, 0, 1); array_push($resourcePrice, array("resourceId" => $resourceId, "notFree" => $notFree, "price" => $price)); } //print_r($resourcePrice); $tradeModel = new TradeModel(); $result = $tradeModel->newResourcePrice($resourcePrice, $schoolId); $this->redirect("getSchoolPrice?schoolId=" . $schoolId); }