使用php删除特殊字符?

使用php删除特殊字符?,php,Php,我的绳子有问题 $string = 'United Kingdom  ,Argentina  '; 我想删除“the” 有人能告诉我如何移除并使上面显示的字符串像这样吗 $string = 'United Kingdom ,Argentina'; 提前感谢。您可以通过Preg-Replace使用Regex preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '', $string); 或者,如果您只想替换字符,那么您可以这样做

我的绳子有问题

 $string = 'United Kingdom  ,Argentina  ';
我想删除“the”

有人能告诉我如何移除并使上面显示的字符串像这样吗

$string = 'United Kingdom ,Argentina';

提前感谢。

您可以通过
Preg-Replace
使用
Regex

preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '', $string);
或者,如果您只想替换字符
,那么您可以这样做

$string = str_replace('Â', '', $string);

您可以通过
Preg Replace
使用
Regex

preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '', $string);
或者,如果您只想替换字符
,那么您可以这样做

$string = str_replace('Â', '', $string);
简单。。试试这个:

$string = str_replace('Â', ' ', $string);
简单。。试试这个:

$string = str_replace('Â', ' ', $string);

感谢大家给了我宝贵的时间,我已经用(html_entity_decode())这个函数找到了它的解决方案

感谢大家给了我宝贵的时间,我用(html_entity_decode())这个函数找到了它的解决方案