工作,我有我有编码的,像这样json_decode不会对我的字符串
{
"id": "",
"steps": [
{
"target": "purchase_order_items_itemmaster_id",
"title": "",
"placement": "",
"content": "",
"xoffset": "",
"yoffset": ""
}
]
}
$JSONData = json_encode($finalData,JSON_PRETTY_PRINT);
我借此JSON数据并将其存储在一个文件中,像这样
File::put("path","var tour = \n [ \n\t $JSONData \n ];");
JSON对象,看起来是这样的文件
var tour =
[
{
"id": "",
"steps": [
{
"target": "purchase_order_items_itemmaster_id",
"title": "",
"placement": "",
"content": "",
"xoffset": "",
"yoffset": ""
}
]
}
];
现在,在我读回来形成像这样
0123第二线[
{
"id": "",
"steps": [
{
"target": "purchase_order_items_itemmaster_id",
"title": "",
"placement": "",
"content": "",
"xoffset": "",
"yoffset": ""
}
]
}
];
问题是,当我想它解码回到它不会发生,这就是我正在尝试的是,根据预期的输出
$lines = file_get_contents("path",NULL,NULL,10);
$a = json_decode($lines);
我们做一个$应该有解码的数据,但它有空。
有人能指出错误吗?
HTTP ://php.net/manual/en/function.json-las t-error.php它打印什么? – varuog