{
echo
“<font color=green>您输入的[".$str."]完全合法,通过!</font>”;
}
}
?>
<form method=”post” action=”">
输入字符(数字,字母,汉字,下划线):
<input type=”text” name=”dir” value=”">
<input type=”submit” value=”
”
提交 >
</form>
gbk:
preg_match(“/^[".chr(0xa1)."-".chr(0xff)."a-za-z0-9_] $/”,
$str
);
//gb2312 汉字字母数字下划线
正则表达式