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