php中删除html标签里的属性(可用正则表达式)
比如代码如下:
$str = '<span style="font-family:\'Arial\',\'sans-serif\';font-size:9pt;">test</span>';
$str=stripslashes($str);
echo htmlspecialchars($str)."<br/>";
$str = '<span style="font-family:\'Arial\',\'sans-serif\';font-size:9pt;">test</span>';
//$str=stripslashes($str);
$str = preg_replace('#<([^>\s/]+)[^>]*>#','<$1>',$str);
echo htmlspecialchars($str)."<br/>";