php foreach循环添加数据,为什么只插入一条。代码如下
Array([0]=>1752[1]=>1751[2]=>1745[3]=>768)publicfunctionactionGetSelectedDeducBorrowe...
Array
(
[0] => 1752
[1] => 1751
[2] => 1745
[3] => 768
)
public function actionGetSelectedDeducBorrowers() {
$modelD = new BorrowPaymentedDebt;
$ast = $_POST['AvailableRightMonth']['selBorrowers'];
$arr = explode(',', $ast, -1);
foreach ($arr as $k => $v) {
if (!empty($v)) {
echo $modelD->borrowerID = $v;
echo $modelD->save();
}
} 展开
(
[0] => 1752
[1] => 1751
[2] => 1745
[3] => 768
)
public function actionGetSelectedDeducBorrowers() {
$modelD = new BorrowPaymentedDebt;
$ast = $_POST['AvailableRightMonth']['selBorrowers'];
$arr = explode(',', $ast, -1);
foreach ($arr as $k => $v) {
if (!empty($v)) {
echo $modelD->borrowerID = $v;
echo $modelD->save();
}
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询