Refer:http://www.wilf.cn/post/php-match-chinese-str.html
Since having a black hat seo, dealing with spam (spam) has been one of the job content of the site staff. The persecution of our not spam message group machine, is the garbage user registration machine.
Judging whether the string contains Chinese is one way to deal with spam, can effectively block the pure English spam, you can also use this method to standardize user registration. Look at the code below, compatible with gb2312 and Utf-8.
!--? $str =" Test Chinese ", Echo $str, echo" ",//if (Preg_match ("/^[". Chr (0XA1)." -". Chr (0xff)." and #43, $/", $str)) {//can only be used in GB2312 case//if (Preg_match ("/^[\x7f-\xff]& #43; $/", $str)) {//compatible GB2312,UTF-8//Determine if the string is all Chinese if ( Preg_match ("/[\x7f-\xff]/", $str)) {//Determine if there is a Chinese echo "correct input" in the string;} else {echo "error input";}? -->
, double-byte character encoding range
1. GBK (gb2312/gb18030)
\x00-\xff GBK Double-byte encoding range
\x20-\x7f ASCII
\xa1-\xff Chinese gb2312
\x80-\xff Chinese GBK
2. UTF-8 (Unicode)
\u4e00-\u9fa5 (Chinese)
\x3130-\x318f (Korean
\xac00-\xd7a3 (Korean)
\u0800-\u4e00 (Japanese) */
The above describes the PHP judgment string contains Chinese, including aspects of the content, I hope the PHP tutorial interested in a friend helpful.