2016-03-18 56 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); 
    ?> 

的操纵工作,但也有一些ä,ö,ü和/符号,这是改为澶......和/输出文件。有什么办法解决这个问题吗?

感谢

回答