php 正则表达式含义
$string = preg_replace('/&((#(\d{3,5}|x[a-fA-F0-9]{4}));)/', '&\\1',
str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $string));
转义字符串中的特殊字符
'/&((#(\d{3,5}|x[a-fA-F0-9]{4}));)/', '&\\1', 这部分含义?
<br /> <br /> //取消HTML代码<br /> function shtmlspecialchars($string) {<br /> if(is_array($string)) {<br /> foreach($string as $key => $val) {<br /> $string[$key] = shtmlspecialchars($val);<br /> }<br /> } else{<br /> $string = preg_replace('/&((#(\d{3,5}<br><font color='#FF8000'>------解决方案--------------------</font><br>x[a-fA-F0-9]{4})<br><font color='#FF8000'>------解决方案--------------------</font><br>[a-zA-Z][a-z0-9]{1,5});)/', '&\\1',<br /> str_replace(array('&', '"', '<', '>','\''), array('&', '"', '<', '>','''), $string));<br /> }<br /> return $string;<br /> }<br /> <br />