我正在使用此代码从字符串中删除不需要的字符,但我的ALT + 0160字符存在很大问题,这是一个非中断空格。我也需要删除它
$name = str_replace ("'", "", $name);
$name = str_replace (""", '"', $name);
$name = str_replace ("&", "&", $name);
$name = str_replace ("<", "", $name);
$name = str_replace (">", "", $name);
$name = str_replace ("&", "_", $name);
$name = str_replace ("*", "_", $name);
$name = preg_replace('/[^ \p{L}\p{N} \@ \_ \- \.]/u', '', $name);
答案 0 :(得分:4)
$name=str_replace(chr(0xc2a0),'',$name);