程序功能:截取全角和半角(汉字和英文)混合的字符串以避免乱码
------------------------------------------------------
*/
function substr_cut($str_cut,$length)
{
if (strlen($str_cut) > $length)
{
for($i=0; $i
if (ord($str_cut[$i]) > 128) $i++;
$str_cut = substr($str_cut,0,$i)."..";
}
return $str_cut;
}
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn