由于表述上有一定的困难,所以要做一些变通<?php
$str = "a3r=汉f字00";$p = "/[0-9A-Za-z]|[\x80-\xff]./";
preg_match_all($p,$str,$regs);
if(join("",$regs[0]) != $str)
echo "有非法字符";
else
echo "正确";
?><script>
str = "a3r=汉f字00";
re = /[0-9A-Za-z]|[\x80-\xff]./g;
if(str.replace(/[^\x00-\xff]/g,"A").replace(re,"").length > 0)
alert("有非法字符");
</script>
$str = "a3r=汉f字00";$p = "/[0-9A-Za-z]|[\x80-\xff]./";
preg_match_all($p,$str,$regs);
if(join("",$regs[0]) != $str)
echo "有非法字符";
else
echo "正确";
?><script>
str = "a3r=汉f字00";
re = /[0-9A-Za-z]|[\x80-\xff]./g;
if(str.replace(/[^\x00-\xff]/g,"A").replace(re,"").length > 0)
alert("有非法字符");
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货