【发布时间】:2013-04-27 13:55:15
【问题描述】:
我收到此错误:
解析错误:语法错误,C:\wamp\www\test.php 中出现意外的 T_STRING 在第 2 行
尝试从Reddit's front page打印密钥时
如何修复 *$json_string* 解析错误并显示来自Reddit's front page 的键?提前致谢。
test.php
<?php
$json_string = "{"kind": "Listing", "data": {"modhash": "", "children": [{"kind": "t3", "data": {"domain": "i.imgur.com", "banned_by": null, "media_embed": {}, "subreddit": "pics", "selftext_html": null, "selftext": "", "likes": null, "link_flair_text": null, "id": "1d7lch", "clicked": false, "title": "Graves of a Catholic woman and her Protestant husband, who were not allowed to be buried together.", ... ";
$a = json_decode($json_string);
echo $a.keys();
?>
【问题讨论】:
-
也许你应该学习基本的 PHP 语法,尤其是与字符串相关的...
标签: php json codeigniter wampserver