php中英文判断
程序员文章站
2022-03-19 23:48:07
$str = '中国';
if (preg_match("/^[\x7f-\xff]+$/", $str))
{ //兼容gb23...
$str = '中国';
if (preg_match("/^[\x7f-\xff]+$/", $str))
{ //兼容gb2312,utf-8
echo "zhongwen";
}
else
{
echo "yingwen ";
}
作者“技术人生”