对不起,不能把标题正确地把我的问题,我找不到一个方法来问它。如何替换所有匹配的正则表达式的PHP
所以我试着去替换里面的所有文字和'
在PHP更换为'
我有一个变量$desc = "he's such a good person and he'll be very successfull";
,我尝试做以下
$desc = str_replace("'","'",$desc);
但是在str_replace
中没有办法使用正则表达式?
是的,现在看起来很好...出于某种原因。
有没有办法使用正则表达式呢?
例如从文本中删除html标签?
$desc = "<strong> he's such a good person </strong> <br /> he'll be very successfull";
$desc = str_replace("<*>"," ",$desc);
它工作正常。试试这个https://eval.in/800942 –
它工作正常...? – samiles
您必须在当前行之前的某处使用'htmlentities'。使用'html_entity_decode'将实体解码为它们的文字表示。 –