开发者

single quote replacement problem in php

开发者 https://www.devze.com 2023-01-31 02:07 出处:网络
I need a regular expression patter which similar to this $pattern =\"/[^\\w]/\"; But it should hide html syntax.

I need a regular expression patter which similar to this

$pattern ="/[^\w]/";  

But it should hide html syntax.

$string = preg_replace($开发者_开发技巧pattern,'',$str);


I am not one hundred pourcent sure about what you mean by "hide HTML syntax" but if your content is some html and you want to strip out the html tags use strip_tags function.

so in your example:

$pattern ="/[^\w]/"; 
$string = preg_replace($pattern,'',html_entity_decode(strip_tags($str)));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号