我有这个json,我想在html表中显示它,但我不知道如何实现。
{
“ CPPG-AETOPTII-N1”:{ “ 11044”:“ 359.47”, “ 11045”:“ 47.49”, “描述”:“ Aetna-HMO / PPO-选项II” }, “ CPPG-HMODALP-21”:{ “描述”:“ BCBS-HMO(Dallas-PCP-POS 21)”, “ 0001F”:“ 0.00”, “ 0001M”:“ 7.63”, “ 0001U”:“ 5.00” }, “ CPPG-HMODALP-22”:{ “描述”:“ BCBS-HMO(Dallas-PCP-POS 22)”, “ 0401T”:“ 40.75” } }
使用PHP,我想在这样的表中显示json:
<table border="1">
<tr>
<td>blank space</td>
<td>Aetna - HMO\/PPO - Option II</td><td>BCBS - HMO (Dallas-PCP-POS 21)</td><td>BCBS - HMO (Dallas-PCP-POS 22)</td>
</tr>
<tr>
<td>11044</td>
<td>359.47</td><td></td>
<td></td>
</tr>
<tr>
<td>11045</td>
<td>47.49</td><td></td>
<td></td>
</tr>
<tr>
<td>0001F</td>
<td></td><td>0.00</td>
<td></td>
</tr>
<tr>
<td>0001M</td>
<td></td><td>7.63</td>
<td></td>
</tr>
<tr>
<td>0001U</td>
<td></td><td>5.00</td>
<td></td>
</tr>
<tr>
<td>0401T</td>
<td></td><td></td>
<td>40.75</td>
</tr>
<tr>
<td>0402T</td>
<td></td><td></td>
<td>2500.00</td>
</tr>
</table>
我该如何完成?预先感谢您的帮助。
答案 0 :(得分:0)
assoc设置为true(将对象转换为数组)的json_decode函数将解决您的问题
用法:
json_decode($json, true);
适合您的情况的代码: https://pastebin.com/dVbpj6sS