非凡居

PHP出现JSON_ENCODE中文乱码的最好的解决方法

PHP出现JSON_ENCODE中文乱码的最好的解决方法

<?php  
    $testJSON=array('name'=>'中文字符串','value'=>'test');  
    //echo json_encode($testJSON);  
    foreach ( $testJSON as $key => $value ) {  
        $testJSON[$key] = urlencode ( $value );  
    }  
    echo urldecode ( json_encode ( $testJSON ) );  
?>