utf-8编码
function test($str){
if (preg_match("/^[\x81-\xfe][\x40-\xfe]?/",$str)) {
return "首字母有中文";
}
return "首字母没中文";
}
echo test("中1231213");//首字母有中文
echo test("123中");//首字母没中文追问
if (preg_match("/^[\x81-\xfe][\x40-\xfe]?/",$str)) {
return "首字母有中文";
}
return "首字母没中文";
}
echo test("中1231213");//首字母有中文
echo test("123中");//首字母没中文追问
无效
追答你从哪里得出来无效的
获取字符串的时候出了问题,你写的确实有效 -,- 谢谢
温馨提示:答案为网友推荐,仅供参考