How to save a JSON as unescaped UTF-8 in PHP 5.3?

前端 未结 5 1437
失恋的感觉
失恋的感觉 2020-12-10 19:40

I created a JSON file:

$json = array(
    \"Sample\" =>array(
        \"context\" => $context,
        \"date\"    => $date
    )
);

$url= \"sample         


        
5条回答
  •  情歌与酒
    2020-12-10 20:00

    You can use the mbstring approach:

    Try like this:

    fwrite($myfile, mb_convert_encoding(json_encode($json), "UTF-8"));
    

提交回复
热议问题