中文字符串截取
时间:2006-06-26 来源:yanjing5462
function ChgTitle40($title)
{
$length = 40; //我们允许字符串显示的最大长度
if (strlen($title) > $length) {
$temp = 0;
for($i=0; $i 128) $temp++;
if ($temp%2 == 0)
$title = substr($title,0,$length)."...";
else
$title = substr($title,0,$length+1)."...";
}
return $title;
}
{
$length = 40; //我们允许字符串显示的最大长度
if (strlen($title) > $length) {
$temp = 0;
for($i=0; $i 128) $temp++;
if ($temp%2 == 0)
$title = substr($title,0,$length)."...";
else
$title = substr($title,0,$length+1)."...";
}
return $title;
}
相关阅读 更多 +