-1
所以,我想在HTML表格中打印下面的三维数组。PHP打印三维数组
array ('BTC_YACC' => array (0 => array ('orderNumber' => '3585379', 'type' => 'sell', 'rate' => '0.0001', 'amount' => '128', 'total' => '0.0128', 'date' => '2014-05-18 08:54:37',),),)
这就是我想到的:(OrderNumber = OrderID)。
$tableopenorders = "<table><th>OrderID</th><th>Type</th><th>Rate</th><th>Amount</th><th>Total in BTC</th><th>Date placed</th><tr>";
for($element = 0; $element < count($decodedopenorders); $element++) {
$tableopenorders .= "<tr>";
for($row = 0; $row < 1; $row++) {
for ($col = 0; $col < 6; $col++) {
$tableopenorders .= "<td>".$decodedopenorders[$element][$row][$col]."</td>";
}
}
$tableopenorders .= "</tr>";
}
$tableopenorders .= "</table>";
有一个最大 “计数($ decodedopenorders)” $元素,最大的是。 $ decodedopenorders数组中的1行和6行。迭代器开始一个0,所以我用<。
为什么这不起作用?
为什么你需要这个循环'for($ row = 0; $ row <1; $ row ++)'? – Lewis
猎户座,我认为这将有助于构建循环。 – user3586358
你知道数组和关联数组有区别吗? $ a [0]与$ a ['someKey']不一样。另外,如果你坚持用数字索引访问它们,请阅读array_values的文档。 –