【发布时间】:2014-06-19 17:22:29
【问题描述】:
读入我的编辑器时文件看起来很好。
$file = file_get_contents('path/to/file.json');
$json = json_decode($file, true);
var_dump($json); // null
echo json_last_error_msg(); //Control character error, possibly incorrectly encoded
关于此错误消息的含义并不多。
【问题讨论】:
-
能否请您发布您的
file.json?因为json_decode无法从文件中解码您的 json 字符串。 -
这意味着您的文件不包含有效的 JSON。