function ChgTitle($title) { $length = 46; if (strlen($title)$length) { $temp = 0; for($i=0; $i<$length; $i++) if (ord($title[$i]) 128) $temp++; if ($temp%2 == 0) $title = substr($title,0,$length)."..."; else $title = substr($title,0,$length+1)."..."; } return $title; } 原理就是截断一个字符,看看其ascII码是不是大于128...
[ 查看全文 ]