2
我正在考虑一种方法来使td rowspans与相同的项目?..我的意思是如何将td rowspans添加到表中?
看看下面的这张表,这是如何输出看起来像,只是一个例子。
我怎样才能使输出这个样子的,所以在处理事情会容易..
这里代码
$get = file_get_contents('URL');
$json = json_decode($get, true);
$items = $json['Catalogue'][0]['Accessories'];
$quantity = $json['Accessories'][1]['Quantity'];
$price = $json['Accessories'][2]['Price'];
echo
"<table border=1>
<tr>
<th width=200px>Items</th>
<th width=100px>Quantity</th>
<th width=100px>Price</th>
</tr>
<tr>
<td>".$items."</td>
<td>".$quantity."</td>
<td>".$price."</td>
</tr>
</table>";
你能不能给我们说,你正在使用的'$ json'阵列的一个更好的主意?它不会出现会有多于一个标题行和一个正文行。 – Scopey 2014-11-23 21:43:57
这是一个来自服务器的api请求,所以更多的物品会将它们显示为json – fcbrmadrid 2014-11-23 22:01:19
但是您需要说明如何执行此操作。在这一点上,你甚至没有在你的例子中有一个循环,所以我看不出你是如何创建表的。 – Scopey 2014-11-23 22:03:11