PHP json_encode无法使用撇号

时间:2016-06-09 15:01:32

标签: php

我尝试json编码一个数组,它总是有效,除非数组中有一个包含这个确切撇号的字符串ANYWHERE" "

我尝试用字符串代替它,但它不起作用......

        $thistrack = str_replace('’','',$thistrack);
        $thistrack = str_replace('\u2019','',$thistrack);
        $thistrack = str_replace('\0092','',$thistrack);
        $thistrack = str_replace('\\\\u0027','',$thistrack);

在这种情况下。 $ thistrack包含以下内容: var_dump($thistrack); Var_Dump

最后,这就是我想要实现的目标。

$savestuff = file_put_contents($savepath.'history.rhr', json_encode($completehistory));

但文件是空的,当数组中某处有时,总会发生这种情况......

0 个答案:

没有答案