我不知道发生了什么,但我在数组中有一个字符串.它必须是一个字符串,因为我先在它上面运行它:
$array[0] = (string)$array[0];
Run Code Online (Sandbox Code Playgroud)
如果我以纯文本形式将$ array [0]输出到浏览器,它会显示:
hellothere
Run Code Online (Sandbox Code Playgroud)
但如果我JSON编码$ array我得到这个:
hello\u0000there
Run Code Online (Sandbox Code Playgroud)
另外,我需要将'there'部分(\ u0000之后的位)分开,但这不起作用:
explode('\u0000', $array[0]);
Run Code Online (Sandbox Code Playgroud)
我甚至不知道\ u0000是什么或如何在PHP中控制它.
我确实看到了这个链接:试图从我的json中找到并摆脱这个\ u0000 ...这表明str_replacing生成的JSON.我不能这样做(并且需要先将上面提到的它分开)所以我然后检查了Google的'php check for backslash\0 byte'但我仍然无法解决该怎么做.