Home > Article > Backend Development > PHP怎么从一段格式标准的字符串中提取自己需要的信息
PHP如何从一段格式标准的字符串中提取自己需要的信息?
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> { 'status':'200', 'message':'ok','updatetime':'2012-10-05 12:46:21','ischeck':'1','com':'yuantong','nu':'2636535819','state':'3','condition':'F00','data':[ {'time':'2012-07-09 13:22:02','context':'北京市海淀区中关村鼎好/PDA正常签收扫描/签收人:医院收发室 ','ftime':'2012-07-09 13:22:02'},{'time':'2012-07-08 12:39:58','context':'北京市海淀区中关村鼎好/留仓件入扫描节假日客户休息 ','ftime':'2012-07-08 12:39:58'},{'time':'2012-07-08 12:35:01','context':'北京市海淀区中关村鼎好/派件扫描/派件人:王一民 ','ftime':'2012-07-08 12:35:01'},{'time':'2012-07-08 11:05:08','context':'北京市海淀区中关村鼎好/下车扫描 ','ftime':'2012-07-08 11:05:08'},{'time':'2012-07-08 06:53:20','context':'北京市海淀区中关村/装件入车扫描 ','ftime':'2012-07-08 06:53:20'},{'time':'2012-07-08 05:09:31','context':'北京分拨中心/装件入车扫描 ','ftime':'2012-07-08 05:09:31'},{'time':'2012-07-07 22:26:21','context':'北京分拨中心/装件入车扫描 ','ftime':'2012-07-07 22:26:21'},{'time':'2012-07-07 22:22:13','context':'北京分拨中心/拆包扫描 ','ftime':'2012-07-07 22:22:13'},{'time':'2012-07-07 20:01:34','context':'北京市通州区城区/揽收扫描/取件人:王昌征 ','ftime':'2012-07-07 20:01:34'},{'time':'2012-07-07 17:35:24','context':'北京市通州区城区/业务员收件/取件人:张蒙 ','ftime':'2012-07-07 17:35:24'}]}
$current= strtr($current0, "'", '"'); $json = json_decode($current); echo $json->message; $length=count($json->data);; $bottom=$length-1; echo $json->data[$bottom]->context; <div class="clear"> </div>