我看到這個〔實施例,但仍然不知道如何去了解它通過對象循環(stdClass的)
的問題是,他們調換表中插入列 - >行而不是行 - >列,你可以做通過創建一個新表並反轉列和行。
$table = array();
foreach ($result['xxx']->Columns->Column as $colnr => $coldata) {
foreach ($coldata->Rows->string as $rownr => $rowdata) {
$table[$rownr][$coldata->Name] = $rowdata;
}
}
print_r($ table);
有人可以幫助我循環這些數據,計劃將數據顯示爲表 var_dump($ result-> result)的結果;
object(stdClass) #5 (1) {
["complexObjectArray"]= > array(5) {
[0] = > object(stdClass) #6 (105) {
["increment_id"]= > string(9) "100000118"
["store_id"] = > string(1) "1"
["created_at"] = > string(19) "2013-04-21 07:14:34"
}
[1] = > object(stdClass) #7 (104) {
["increment_id"]= > string(9) "100000128"
["store_id"] = > string(1) "1"
["created_at"] = > string(19) "2013-04-22 09:50:27"
}
[2] = > object(stdClass) #8 (105) {
["increment_id"]= > string(9) "100000133"
["store_id"] = > string(1) "1"
["created_at"] = > string(19) "2013-04-24 07:43:40"
["updated_at"] = > string(19) "2013-04-27 14:50:23"
}
[3] = > object(stdClass) #9 (108) {
["increment_id"]= > string(9) "100000156"
["store_id"] = > string(1) "1"
["created_at"] = > string(19) "2013-05-07 14:41:30"
}
}
}
我在想東西解決此
@dleiftah感謝格式化,我盤算如何做到這一點:X – CodeGuru