Kat*_*rin 3 php xml special-characters
我想问使用 php 删除不需要的特殊字符(如 RS)的最佳方法是什么?因为如果我的xml文档中包含这样的字符,就会导致客户端程序解析失败。
(数据源包含英文和中文字符)
谢谢!!
$output = strtr($input, "\x1E\x06", " "); // Remove RS and ACK
Run Code Online (Sandbox Code Playgroud)
(第一个字符串中有 2 个字符,第二个字符串中有 2 个空格)
或带有preg_replace的范围:
$output = preg_replace("/[\x1C-\x1F]/", "", $input); // Remove FS GS RS US
Run Code Online (Sandbox Code Playgroud)