限制注音文的寫法

Home Home
引用 | 編輯 月光
2007-05-14 20:35
樓主
推文 x0
複製程式
<?php   
function chkword($word){   
    $mb_wordlen=mb_strlen($word, big5);   
    for ($i=0; $i<$mb_wordlen; $i++){   
        $num=''   
        $mb_len=mb_substr($word, $i, 1, big5);   
        $wordlen=strlen($mb_len);   
        for ($j=0; $j<$wordlen; $j++){   
            $len=substr($mb_len, $j, 1);   
            $num.=Ord($len);   
            if ($j==$wordlen-1){   
                if (($num>=163116 && $num<=163126) || ($num>=163161 && $num<=163186)){   
                    $cls=1; break;   
                }   
            }   
        }   
        if ($cls)break;   
    }   
    return $cls;   
}   
  
//使用範例   
if (chkword($word)){   
    echo "請勿使用注音文";   
}   
?>  


獻花 x0
引用 | 編輯 xxx1474
2007-06-23 14:25
1樓
  
測試成功喔 表情 ~
收文收文~ 表情

獻花 x0