2016-03-18 59 views
0

我試圖操縱用PHP JSON文件和我遇到的問題,該函數json_encode與JSON_UNESCAPED_UNICODE不能正常工作

$json = json_encode($cd, JSON_UNESCAPED_UNICODE); 

工作不正常。

代碼:

<?php 
    $contents = file_get_contents('file.json'); 
    $ut= utf8_encode($contents); 
    $cd = json_decode($ut, true);   
    $cd['File'][0]['Name']="AnotherName"; 
    $json = json_encode($cd, JSON_UNESCAPED_UNICODE); 
    file_put_contents('general.json', $json); 
    ?> 

的操縱工作,但也有一些ä,ö,ü和/符號,這是改爲澶......和/輸出文件。有什麼辦法解決這個問題嗎?

感謝

回答