我想从这个多维数组中获取数据:
Array
(
[result] => success
[source] => getLatestConsoleLogs
[success] => Array
(
[0] => Array
(
[time] => 1324301613
[line] => 2011-12-19 17:33:33 [INFO] [JSONAPI] [API Call] 0:0:0:0:0:0:0:1: method=getLatestConsoleLogs?args=[]
)
[1] => Array
(
[time] => 1324301613
[line] => 2011-12-19 17:33:33 [INFO] [JSONAPI] [API Call] 0:0:0:0:0:0:0:1: method=getLatestConsoleLogs?args=[]
)
[2] => Array
(
[time] => 1324301613
[line] => 2011-12-19 17:33:33 [INFO] [JSONAPI] [API Call] 0:0:0:0:0:0:0:1: method=getLatestConsoleLogs?args=[]
)
)
)
我会很高兴,如果不知何故它可以被提取到div`s。感谢。
答案 0 :(得分:1)
你可以json_encode()将数组转换为JSON,然后使用javascript将它们放在适当的div中
如果您想在服务器端执行此操作,可以查看
答案 1 :(得分:1)
你可以像这样使用普通的foreach循环:
$successes = $array['success'] /* where $array is the variable holding the result */
foreach($successes as $success) {
echo "<div>Time: " . $success['time'] . " - Line: " . $success['line'] . "</div>";
}