【发布时间】:2016-05-31 09:00:36
【问题描述】:
我正在尝试读取和 json_decode 一个包含一些 json_encoded 元素的文件。我的 php 文件正在读取编码的元素,但没有将其解码为数组。有什么问题?
<?php
$filename1 ="history.txt";
$filecontent=file_get_contents($filename1);
$history=Array();
$history=json_decode($fileContent,true);
$ar_size=sizeof($history);
echo $filecontent;
echo $ar_size;
?>
第一个回显给出 file1 的文件内容,但第二个回显给出 0。我的 history.txt 包含:
[" 1 2 3 4 5 6 7 8 9 10 11 &2.829476 "," 1 2 4 3 5 6 7 8 9 10 11 &2.782541 "]
【问题讨论】:
-
好的,已编辑.. 仍未修复