我从json这样的数据
"rajaongkir":{
"result":{
"manifest":[
{
"manifest_code":"1",
"manifest_description":"Manifested",
"manifest_date":"2015-03-04",
"manifest_time":"03:41",
"city_name":"xxxx"
},
{
"manifest_code":"2",
"manifest_description":"On Transit",
"manifest_date":"2015-03-04",
"manifest_time":"15:44",
"city_name":"xxxx"
},
{
"manifest_code":"3",
"manifest_description":"Received On Destination",
"manifest_date":"2015-03-05",
"manifest_time":"08:57",
"city_name":"xxxx"
}
]
我想在表格中显示上面的数据,所以我创建了如下代码
$decode=json_decode($response, true);
<?php
for($j=0; $j < count($decode['rajaongkir']['result']); $j++)
{
?>
<tr>
<td><?php echo $decode['rajaongkir']['result']['manifest'][$j]['manifest_date']; ?> <?php echo $decode['rajaongkir']['result']['manifest'][$j]['manifest_time']; ?></td><td><?php echo $decode['rajaongkir']['result']['manifest'][$j]['city_name']; ?></td><td><?php echo $decode['rajaongkir']['result']['manifest'][$j]['manifest_description']; ?></td>
</tr>
<?php
}
?>
数据显示正确,但在表格之后,我有通知注意:未定义的偏移量:2。在...中注意:未定义的偏移量:4。在......
你知道如何解决这个问题吗?
谢谢
答案 0 :(得分:0)
我知道了,我的错是在模式中。
当模式正确时,通知已消失