HOME
DOMAIN
WEB HOST
AUTO Site
VPS SERVER
CLOUD HOST
SERVER
HK HOST
AGENT
SERVICE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>php 中文与英语正则表达式</title> </head> <body> <form id="phpfensi.com" name="phpfensi.com" method="post" action=""> <input name="url" type="text" /> <input name="" type="submit" value="提交 "/> </form> </body> </html> <?php function funcChinese($str,$num1='',$num2='')//判断中文正则 {//开源代码phpfensi.com if($num1!='' and $num2!=''){ return (preg_match("/^([x81-xfe][x40-xfe]) {".$num1.",".$num2."}$/",$str))?true:false; }else{ return (!eregi("[^x80-xff]","$str"))? true:false; } } if( $_POST) { if( funcChinese( $_POST['url'] ) ) { echo '是中文'; } else { exit('不是有效中文'); } } //这个只能一个个字符判断,你可以用foreach来处理 ?>