解析的時候,這裏是我們的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