我能够从api打印响应,但它是嵌套数组,我无法保存它。
Array
(
[statuscode] => 0
[status] => SUCCESS
[item] => SimpleXMLElement Object
(
[item] => Array
(
[0] => SimpleXMLElement Object
(
[BENEID] => 227287
[BENENAME] => test
[BANKNAME] => test
[BRANCHNAME] => test
[CITY] => test
[STATE] => tetst
[IFSCCODE] => HBNB
[ACCOUNTNO] => 4545345
[MMID] => SimpleXMLElement Object
(
[0] =>
)
[MOBILE] => 0
[BENESTATUS] => Approved
[MMIDSTATUS] => 0
[IFSCSTATUS] => 1
[IMPSMMIDENABLE] => 0
[IMPSIFSCENABLE] => 0
[IMPSNEFTENABLE] => 1
[DELETESTATUS] => 0
)
)
)
)
这是我想要分别打印所有字段的响应
答案 0 :(得分:0)
这非常简单,只需遵循您从API获得的响应结构
试试这个: -
我想你在阵列中的回复 $ reponseArray
foreach($reponseArray['item']->item as $value)
{
foreach($value as $key=>$val)
{
echo $key.' = '. $val;
}
}