Home > Backend Development > PHP Tutorial > PHP regular matching gb2312 and utf-8 Chinese_PHP tutorial

PHP regular matching gb2312 and utf-8 Chinese_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:54:20
Original
1047 people have browsed it

$action = trim($_get['action']);
if($action == "sub")
{
$str = $_post['dir'];
//if(!preg_match("/^[".chr(0xa1)."-".chr(0xff)."a-za-z0-9_]+$/",$str)) //gb2312 Chinese characters Number underline regular expression
if(!preg_match("/^[x{4e00}-x{9fa5}a-za-z0-9_]+$/u",$str)) //utf-8 Chinese character alphanumeric underline regular expression
{
echo "The [".$str."] you entered contains illegal characters";
}
else
{
echo "The [".$str."] you entered is completely legal and passed!";
}
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632342.htmlTechArticle?php tutorial $action = trim($_get['action']); if($action == sub ) { $str = $_post['dir']; //if(!preg_match(/^[.chr(0xa1).-.chr(0xff).a-za-z0-9_]+$/,$str )) //gb2312 Chinese characters alphanumeric underline...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template