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 ) );  
?>  

发表评论