解析的时候,这里是我们的JSON的一个示例提要:需要保持反斜杠JSON饲料在PHP
{"wiggins": {
"id": "bkstir-04380-wdr-q",
"alertcolour": "yellow",
"infohvr": "",
"infoclk": "",
"warning": "10",
"warnhvr": "There are 10 files stuck in \\server.domain.co.uk\Country\Dept\Output",
"warnclk": "\\server.domain.co.uk\Country\Dept\Output",
"process": "abc-app-015 Spooler",
"processhvr": "",
"processclk": "http://xyz-abc-001.svr.domain.co.uk/monitors/39.html"
}}
反斜线从显示它停止PHP的,如果我有一个JSON没有任何反斜杠然后它们显示正常,但是我需要在那里显示斜线,因为显示页面的人需要转到链接。为了让它现在工作,我也试过stipslashes()
,但它不起作用。任何人都可以提供任何建议吗?谢谢。这是解析文件中的代码(如我说的,这一点只要没有反斜杠作品):
$path = "../../Admins/VBScript/Monitors/JSON/"; //where JSONs are stored
foreach (glob($path."*.json") as $file){ //loop through each file
$json = file_get_contents($file); //get JSON files
$data = json_decode($json, true); //parse the file
的JSON文件回来我测试过他们的网站上是有效的。
确实会消失吗?或者他们看起来像一个'\'? – Yazan 2014-11-02 15:36:50