array(1) {
[0]=>
array(11) {
["deductionspayment"]=>
array(3) {
[0]=>
array(3) {
["amount"]=>
string(4) "1.03"
["year"]=>
string(4) "2017"
["month"]=>
string(5) "March"
}
[1]=>
array(3) {
["amount"]=>
string(4) "1.03"
["year"]=>
string(4) "2017"
["month"]=>
string(5) "April"
}
[2]=>
array(3) {
["amount"]=>
string(4) "1.03"
["year"]=>
string(4) "2017"
["month"]=>
string(3) "May"
}
}
["deductionsname"]=>
string(3) "SSS"
["deductionstart"]=>
string(10) "2017-03-08"
["deductionsend"]=>
string(10) "2017-03-14"
["deductionsamount"]=>
string(4) "3.09"
["deductionsyears"]=>
string(1) "3"
["deductionsdate"]=>
string(10) "2017-03-18"
["deductionschedule"]=>
string(1) "3"
["deductionstype"]=>
string(1) "1"
["deductionsprincipalamount"]=>
string(1) "3"
["deductionsinterest"]=>
string(1) "3"
}
}
<br />
<b>Warning</b>: stripslashes() expects parameter 1 to be string, array given in
<b>Warning</b>: Invalid argument supplied for foreach() in
{"error":false,"message":"Update Successful.!"}
这是我的我的$jsondeduction
的的var_dump,我在的foreach使用这个喜欢PHP的foreach得到的stripslashes()预计参数1
foreach ($jsondeduction as $val) {
$jsondeductionspayments = json_decode(stripslashes($val['deductionspayment']), true);
但我得到的错误,我假设错误从这一行来: $jsondeductionspayments = json_decode(stripslashes($val['deductionspayment']), true);
我应该如何格式化该数据,以便stripslashes
第一个问题是 - 为什么你甚至使用'stripslashes'? –
删除斜线以防有斜杠? – Giant
错误本身说你应该传递字符串而不是数组(数组) –