$htmlon = $htmlon && $allowhtml ? 1 : 0; // 修改為$htmlon = $htmlon && $allowhtml ? 1 : 1;
if(!$htmlon) {
$message = dhtmlspecialchars($message);
}
這樣html的就可以使用了,但是所有人都能使用,這個后續(xù)再來研究,目前已經(jīng)可以滿足要求了。
當(dāng)然也可以自己定義function_core.php里的
function dhtmlspecialchars($string) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = dhtmlspecialchars($val);
}
}else {
$string = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $string);
if(strpos($string, '&#') !== false) {
$string = preg_replace('/&((#(d{3,5}|x[a-fA-F0-9]{4}));)/', '&\1', $string);
}
}
return $string;
}
這樣可以自己控制哪些標(biāo)簽的替換。