如何用PHP删除alt字符代码

时间:2013-05-04 12:53:25

标签: php string character strip

我正在使用此代码从字符串中删除不需要的字符,但我的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);

1 个答案:

答案 0 :(得分:4)

$name=str_replace(chr(0xc2a0),'',$name);