For help, the traversal array has such an array. now I can get the data array & nbsp; method $ data-& gt; data, and now I want to traverse the data below the data cyclically. I use this form of for, but the failure $ data-& gt; $ I-& gt; zqdm can also be pointed out by experts. The original array is PH for help, traversing the array
There is such an array
Now I can get the data array
Method:
$ Data-> data
Now I want to traverse the data below the data in a loop. I use
In this form, but failed
$ Data-> $ I-> zqdm
Please give me some advice.
The original array is
PHP code
StdClass Object ([totalPages] => 30 [p] => 1 [totalCount] => 299 [data] => Array ([0] => stdClass Object ([uin] => 843035290 [grpId] => 0 [jydm] => [zqdm] => 600251 [zqjc] => why? call [type] => s [cbj] => 21.97 [amount] => 1000 [date] => 09:32:41) [1] => stdClass Object ([uin] => 843035290 [grpId] => 0 [jydm] => [zqdm] => 600251 [zqjc] => Zookeeper without authorization 'call [type] => B [cbj] => 22.29 [amount] => 1 000 [date] => 14:34:08) [2] => stdClass Object ([uin] => 843035290 [grpId] => 0 [jydm] => [zqdm] => 600537 [zqjc] => zookeeper? Too many tasks? [Type] => s [cbj] => 21.6 [amount] => 1000 [date] => 13:00:24 )))
------ Solution --------------------
I don't know what you're talking about.
------ Solution --------------------
[Data] => Array
(
[0] => stdClass Object
Note: data is an array.
$ Data-> data [$ I]-> zqdm
------ Solution --------------------
$ Data-> data [$ I]-> zqdm
------ Solution --------------------
Use foreach $ data-> data as $ k => $ v. simpleXML in the manual can find relevant information.
------ Solution --------------------
Unless you provide the error data
PHP code
$ D-> data [2]-> x = 'abc'; print_r ($ d); echo $ d-> data [2]-> x;
------ Solution --------------------
Discussion
$ Data-> data [$ I]-> zqdm
------ Solution --------------------
Foreach ($ data-> data as $ k => $ v ){
Echo $ k. '=>'. $ v .'
';
}
------ Solution --------------------
No echo. use print_r.
------ Solution --------------------
Discussion
Error,
Notice: Undefined variable: s in
Foreach ($ data-> data as $ k => $ v ){
Echo"
"; Print_r ($ k." => ". $ s );
}
Reference:
Foreach ($ data-> data as $ k => $ v ){
Echo $ k. '=>'. $ v .'
'......
------ Solution --------------------
Syntax error, unexpected T_EXIT, expect T_FUNCTION ???
How do you know where the error is?