single quote replacement problem in php
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)));
精彩评论