本文介绍了我将这个json解析成php数组的方式有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿大家好!抱歉问这么简单的问题,但我是编程的新手。
我试图将一个json字符串解析成一个php数组,我无法弄清楚我做错了什么。
***我应该补充一点,我没有看到任何错误消息,但是当我尝试使用print_r()打印时,我的数组不会打印;
这是我的代码:
<?php
$ jsonData = ' {id:100,name:Manhattan,level:1,city:New York,state : NY 路径: 曼哈顿, PARENT_ID:1, boundary_encoded_points_string: kfqwFzkwbM} uAwM_iAmIgi @ yQyfDm {BqmGc`Eon @き@ IR @ {OGT @ cCcSia @ {吨@ e` @ } K和@} LWI @ K [QBE [〜的Fc]李} KzEcO ^ aUxFgN〜I {的Gd] pEff @ XE @ RA @ H [PZ @ TJ @ HJA一b @ loAoFfhAdAdf @ EA @ JK @ {@ VC @ HH @ DK @〜[PB @ lEfX_HtQ | CjWzWv | @ VP @ NH @ VJ @ bYde @ BF @ DORI @ HVN @ wBvtAtf @ rS的| Y @ zEzfA |奥法@ TE @〜| @ {B | O @ _Wd\\\ \\} n的@小号@ small_image_uri: /图片/ no_photo_small.png, 称号: 人hattan,副标题:在纽约,详情:}} ;
$ phpArray = json_decode($ jsonData);
print_r($ phpArray);
?>
解决方案
Hey everyone!
sorry to ask such a simple question, but I am new to programming.
I am trying to parse a json string into a php array and I can't figure out what im doing wrong.
*** I should add that i don't see any error messages, but my array does not print when i try to print it with print_r();
Here is my code:
<?php $jsonData = '{"id":100,"name":"Manhattan","level":1,"city":"New York","state":"NY","path":"manhattan","parent_id":1,"boundary_encoded_points_string":"kfqwFzkwbM}uAwM_iAmIgi@yQyfDm{BqmGc`Eon@ki@ir@{Ogt@cCcSia@{t@e`@}k@}Lwi@k[qBe[~Fc]lI}KzEcO^aUxFgN~I{Gd]pEff@xe@ra@h[pz@tj@hjA~b@loAoFfhAdAdf@ea@jk@{@vc@hh@dk@~[pb@lEfX_HtQ|CjWzWv|@vp@nh@vj@bYde@bf@dOri@Hvn@wBvtAtf@rS|y@zEzfA|Ofa@te@~|@{B|o@_Wd\\}n@s@","small_image_uri":"/images/no_photo_small.png","title":"Manhattan","subtitle":"in NYC","details":""}'; $phpArray = json_decode($jsonData); print_r($phpArray); ?>
解决方案
这篇关于我将这个json解析成php数组的方式有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!