How to select a Chinese verification code? The English verification code uses an array of random subscript defining 26 uppercase/lowercase letters and numbers to obtain a random verification code & nbsp; how can I obtain a random Chinese character for the Chinese verification code? Will an array of Chinese characters defined in the same way as in English be too large ?, Notice the Chinese character UCS-2 code from 0x4e00 to 0x9fa Chinese verification code how to choose?
The English verification code uses an array of random subscript defining 26 uppercase/lowercase letters and numbers to obtain a random verification code.
How can I obtain random Chinese characters for the Chinese verification code? Will an array of Chinese characters defined in the same way as in English be too large?
------ Solution --------------------
Note that the UCS-2 encoding of Chinese characters from 0x4e00 to 0x9fa6 is continuous
So you only need
$ Ch = iconv ('ucos-2', 'utf-8', pack ('N', rand (0x4e00, 0x9fa6 )));
You can obtain a random Chinese character.
------ Solution --------------------
Create a common font and the verification function does not need to list all common words
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service