zhangjingyu
require/common.php
/**
* 类似htmlspecialchars_decode函数,因为htmlspecialchars_decode只在PHP 5.1版本及以上才存在
* @param $string
*/
function pwHtmlspecialchars_decode ($string,$decodeTags = true) {
$string = str_replace('&','&', $string);
$string =str_replace(array( '"', ''', '',' '), array('"', "'", ' ',' '), $string);
$decodeTags && $string = str_replace(array('','='),array( '','='),$string);
return $string;
}
/**
* 只解析一部分htmlspecialchars功能
* @param $string
*/
function pwHtmlspecialchars($string,$decodeTags = false) {
return str_replace(array('&', '"', "'", '='), array('&', '"', ''', '='), $string);
}