結果をXML SOAPサービスから取得して、結果をjsonにエンコードして配列にデコードするのがうまくいかない構造の結果を返す。ここで PHPを使用した動的配列の構築
が、私は私の結果で次の機能を実行することで、レンダリングしました出力の例です:$result[implode('/',$keys)] = $val;
Array
(
[accountList/accountNo] => 0610010000048744
[accountList/accountOpeningDate] => 2014-09-01T00:00:00+03:00
[accountList/accountStatus] => DORMANT
[accountList/arrearAmount] => 80000.0
[accountList/arrearDays] => 30
[accountList/balanceAmount] => 120000.0
[accountList/disputed] => false
[accountList/isMyAccount] => false
[accountList/lastPaymentDate] => 2015-01-23T00:00:00+03:00
[accountList/listingDate] => 2014-09-30T00:00:00+03:00
[accountList/pastDueDate] => 1900-01-01T00:00:00+03:00
[accountList/principalAmount] => 300000.0
[accountList/scheduledPaymentAmount] => 0.0
[accountList/tradeSector] => Bank Sector Bureau
[accountList/worstArrear] => 30
[accountList/currency] => KES
[personalProfile/crn] => 79908
[personalProfile/dateOfBirth] => 1959-01-01T00:00:00+02:45
[personalProfile/fullName] => Surname 79908 OtherNames 79908
[personalProfile/gender] => F
[personalProfile/nationalID] => ID79908
[summary/npaAccounts/mySector] => 2
[summary/npaAccounts/otherSectors] => 0
[summary/npaTotalValueList/currency] => KES
[summary/npaTotalValueList/mySector] => 120000.0
[summary/npaTotalValueList/otherSectors] => 0.0
[summary/openAccounts/mySector] => 2
[summary/openAccounts/otherSectors] => 0
)
結果とキーは常に私がサーバーに加え、要求に応じて異なりますので、私が欲しいです再帰関数、場合によってはキーなどの多次元配列を構築する。 accountListはこのようになります複数の値
期待どおりの結果を持っていることがあります。次のようにあなたの配列を構築したい
Array
(
[accountList] => Array
(
[accountNo] => 0610010000048744
[accountOpeningDate] => 2014-09-01T00:00:00+03:00
[accountStatus] => DORMANT
[arrearAmount] => 80000.0
[arrearDays] => 30
[balanceAmount] => 120000.0
[disputed] => false
[isMyAccount] => false
[lastPaymentDate] => 2015-01-23T00:00:00+03:00
[listingDate] => 2014-09-30T00:00:00+03:00
[pastDueDate] => 1900-01-01T00:00:00+03:00
[principalAmount] => 300000.0
[scheduledPaymentAmount] => 0.0
[tradeSector] => Bank, Sector Bureau
[worstArrear] => 30
[currency] => KES
)
Array
(
[accountNo] => 0610010000048788
[accountOpeningDate] => 2014-09-01T00:00:00+03:00
[accountStatus] => ACTIVE
[arrearAmount] => 10000.0
[arrearDays] => 90
[balanceAmount] => 10000.0
[disputed] => TRUE
[isMyAccount] => false
[lastPaymentDate] => 2015-01-23T00:00:00+03:00
[listingDate] => 2014-09-30T00:00:00+03:00
[pastDueDate] => 1900-01-01T00:00:00+03:00
[principalAmount] => 300000.0
[scheduledPaymentAmount] => 0.0
[tradeSector] => Bank, Sector Bureau
[worstArrear] => 30
[currency] => KES
)
[personalProfile] => Array
(
[crn] => 79908
[dateOfBirth] => 1959-01-01T00:00:00+02:45
[fullName] => Surname, 79908 OtherNames 79908
[gender] => F
[nationalID] => ID79908
)
)
うん、私たちがテストできるように、あなたは '$ val'の例を与えることができますか? – Passerby
上記の内容に基づいて結果の配列に含まれるものの例を追加できますか? –