For questions about the failure of PHP Chinese character regular expression verification, please give pointers. thank you!
$ Name = $ _ POST ['name']; // $ this-> error ($ name); here you can output "Xiao Ming" if (! Preg_match ('/^ [u4E00-u9FA5] {2, 4} $/', $ name) {$ this-> error ('Real name should consist of 2-4 Chinese characters! ');}
However, the system always prompts "the real name should consist of 2-4 Chinese characters !", Unable to pass
If (! Preg_match ('/^ 1 [0-9] {10} $/', $ _ POST ['mobile']) {
$ This-> error ('Enter the correct mobile phone number !! ');
}
If you enter a correct mobile phone number, you can pass the JavaScript + PHP verification. The JS part is OK.
Reply to discussion (solution)
Your/^ [u4E00-u9FA5] {2, 4} $/is the js regular expression rule string
Php writing '/^ [\ x {4e00}-\ x {9fa5}] {2, 4} $/U'
Oh, there are other differences. thank you! Done