1.本版搜一下,faq里也有,截取中文字符串的函数mb_substr(PHP 4 >= 4.0.6)
mb_substr -- Get part of string
Description
string mb_substr ( string str, int start [, int length [, string encoding]])mb_substr() returns the portion of str specified by the start and length parameters.mb_substr() performs multi-byte safe substr() operation based on number of characters. Position is counted from the beginning of str. First character's position is 0. Second character position is 1, and so on.If encoding is omitted, internal encoding is assumed.encoding is character encoding. If it is omitted, internal character encoding is used.See also mb_strcut(), mb_internal_encoding()
2.不知道

解决方案 »

  1.   

    1.使用这个函数可以解决
    /* 函数 sub_str($text, $length)
    ** 功能 从文本中截取指定长度字符串,考虑了对中文的处理
    ** 参数 $text 要截取的文本
    ** 参数 $length 要截取的字符串长度
    */
    function sub_str($text, $length)
    {
    for ($i=0; $i<$length; $i++)
    {
    $chr = substr($text, $i, 1);
    if (ord($chr) > 0x80)//字符是中文
    {
    $length++;
    $i++;
    } }
    $str = substr($text, 0, $length); 
    return $str;
    }
    2. 右键单击X,选择显示图片,即可