<? $num=50; $TEXT="一串好长的字xxxxxxx一串好长的字xxxxxxx一串好长的字xxxxxxx一串好长的字xxxxxxx一串好长的字xxxxxxx一串好长的字xxxxxxx"; if(strlen($TEXT) > $num) { for($i=0;$i<$num;$i++) { $ch=substr($TEXT,$i,1); if(ord($ch)>127) $i++; } $TEXT= substr($TEXT,0,$i)."....</font>"; } echo $TEXT; ?>