Php-is there a problem with PHP verifying user names? Zhang Sizhong's

Source: Internet
Author: User
Keywords Regular PHP
Regular PHP

Basic can, but this does not, the user name replaced Zhang San OK, why? Newbie's pain, thank you.

 
   
   \'\"\\  ]/';    if(preg_match($_char_pattern,$_string)){        echo '用户名不得包含敏感字符!';    }else{        echo '没有敏感字符';    }?>

Supplement 1:

Replies to the answer:
The blank place is 2 spaces, one half-width, one full-width

\s Use this can be passed, the use of separate half-width space can also be OK, plus full-width filter Zhang Sizhong's.

I just learned, this is really not understand;

Thanks for the answer, I hope it can be solved.

Supplement 2:

JS authentication can be done by Zhang Sizhong's!

    if(/[<>\'\"\  ]/.test(fm.username.value)){            alert("用户名包含非法字符");            fm.username.focus();            return false;                   }
  • Related Article

    Contact Us

    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

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.