这个json数据如何解析
<br />{"heade":["站次","站名","到时","发时","停留","里程","二等座","一等座","特等座"],"item":[["1","济南西","-","07:05","-","-","-","-","-"],["2","泰安","07:23","07:24","1分","59公里","19.5元","29.5元","-"],["3","曲阜东","07:46","07:53","7分","129公里","39.5元","64.5元","-"],["4","滕州东","08:11","08:13","2分","185公里","54.5元","89.5元","-"],["5","枣庄","08:26","08:28","2分","221公里","69.5元","109.5元","-"],["6","徐州东","08:48","08:50","2分","286公里","89.5元","139.5元","-"],["7","蚌埠南","09:32","09:34","2分","442公里","134元","219元","-"],["8","南京南","10:22","10:24","2分","617公里","189元","304元","-"],["9","镇江南","10:44","10:46","2分","682公里","209元","334元","-"],["10","丹阳北","10:57","10:59","2分","714公里","219元","354元","-"],["11","常州北","11:12","11:14","2分","747公里","229元","369元","-"],["12","无锡东","11:32","11:43","11分","804公里","249元","399元","-"],["13","苏州北","11:54","11:56","2分","831公里","254元","409元","-"],["14","昆山南","12:08","12:10","2分","862公里","263.5元","423.5元","-"],["15","上海虹桥","12:27","-","-","912公里","278.5元","448.5元","-"]],"title":"<B>区间里程:912公里 区间时间:5小时22分</B>"}
$json = '{"heade":["站次","站名","到时","发时","停留","里程","二等座","一等座","特等座"],"item":[["1","济南西","-","07:05","-","-","-","-","-"],["2","泰安","07:23","07:24","1分","59公里","19.5元","29.5元","-"],["3","曲阜东","07:46","07:53","7分","129公里","39.5元","64.5元","-"],["4","滕州东","08:11","08:13","2分","185公里","54.5元","89.5元","-"],["5","枣庄","08:26","08:28","2分","221公里","69.5元","109.5元","-"],["6","徐州东","08:48","08:50","2分","286公里","89.5元","139.5元","-"],["7","蚌埠南","09:32","09:34","2分","442公里","134元","219元","-"],["8","南京南","10:22","10:24","2分","617公里","189元","304元","-"],["9","镇江南","10:44","10:46","2分","682公里","209元","334元","-"],["10","丹阳北","10:57","10:59","2分","714公里","219元","354元","-"],["11","常州北","11:12","11:14","2分","747公里","229元","369元","-"],["12","无锡东","11:32","11:43","11分","804公里","249元","399元","-"],["13","苏州北","11:54","11:56","2分","831公里","254元","409元","-"],["14","昆山南","12:08","12:10","2分","862公里","263.5元","423.5元","-"],["15","上海虹桥","12:27","-","-","912公里","278.5元","448.5元","-"]],"title":"<B>区间里程:912公里 区间时间:5小时22分</B>"}';<br />$arr = json_decode($json);<br />var_dump($arr->heade);
$s = '{"heade":["站次","站名","到时","发时","停留","里程","二等座","一等座","特等座"],"item":[["1","济南西","-","07:05","-","-","-","-","-"],["2","泰安","07:23","07:24","1分","59公里","19.5元","29.5元","-"],["3","曲阜东","07:46","07:53","7分","129公里","39.5元","64.5元","-"],["4","滕州东","08:11","08:13","2分","185公里","54.5元","89.5元","-"],["5","枣庄","08:26","08:28","2分","221公里","69.5元","109.5元","-"],["6","徐州东","08:48","08:50","2分","286公里","89.5元","139.5元","-"],["7","蚌埠南","09:32","09:34","2分","442公里","134元","219元","-"],["8","南京南","10:22","10:24","2分","617公里","189元","304元","-"],["9","镇江南","10:44","10:46","2分","682公里","209元","334元","-"],["10","丹阳北","10:57","10:59","2分","714公里","219元","354元","-"],["11","常州北","11:12","11:14","2分","747公里","229元","369元","-"],["12","无锡东","11:32","11:43","11分","804公里","249元","399元","-"],["13","苏州北","11:54","11:56","2分","831公里","254元","409元","-"],["14","昆山南","12:08","12:10","2分","862公里","263.5元","423.5元","-"],["15","上海虹桥","12:27","-","-","912公里","278.5元","448.5元","-"]],"title":"<B>区间里程:912公里 区间时间:5小时22分</B>"}';<br />if(mb_check_encoding($s, 'gbk')) $s = mb_convert_encoding($s, 'utf-8', 'gbk');<br />print_r(json_decode($s, 1));
Array<br>(<br> [heade] => Array<br> (<br> [0] => 站次<br> [1] => 站名<br> [2] => 到时<br> [3] => 发时<br> [4] => 停留<br> [5] => 里程<br> [6] => 二等座<br> [7] => 一等座<br> [8] => 特等座<br> )<br><br> [item] => Array<br> (<br> [0] => Array<br> (<br> [0] => 1<br> [1] => 济南西<br> [2] => -<br> [3] => 07:05<br> [4] => -<br> [5] => -<br> [6] => -<br> [7] => -<div class="clear"> </div>