function htmlencode($string) {
if(is_array($string)) {
foreach($string as $key => $val) {
$string[$key] = htmlencode($val);
}
} else {
$string = preg_replace('/&((#(d{3,5}|x[a-fA-F0-9]{4})|[a-zA-Z][a-z0-9]{2,5});)/', '&\1', str_replace(array('&', '"', ' $length)) {
$wordscut = '';
if(strtolower($charset) == 'utf-8') {
$n = 0;
$tn = 0;
$noc = 0;
while($n $length) {
$n -= $tn;
}
$wordscut = substr($string, 0, $n);
} else {
for($i = 0; $i 127) {
$wordscut .= $string[$i].$string[$i + 1];
$i++;
} else {
$wordscut .= $string[$i];
}
}
}
$wordscut .= $dot;
$string = $wordscut;
}
return htmlencode($string);
}
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










