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