How to Use PHP filter to filter data

Source: Internet
Author: User

The system will output 'Boy @ 163.com 'in full '. If the format is incorrect, for example, 'Boy ', false is output. If the email field is not filled in the form, the system outputs null, that is, null.

 
 
  1. Echo filter_input (INPUT_POST,
    'Email ', FILTER_VALIDATE_EMAIL );

Fourth, PHP filter filters the content of input variables as required

The only difference is that the second parameter uses FILTER_SANITIZE_EMAIL and the output result is different. Assume that an email is sent from the form POST field.

If the data is similar to 'Boy @ 163.com ', the system will completely output 'Boy @ 163.com '. If the format is incorrect, for example, 'boy-afds3', as long as it is in the e-mail format such as numbers, letters, and dashes, the system also outputs 'boy-afds3' completely ′. If the email field is not filled in the form, the system outputs null, that is, null. If it is 'Boy a 3', the system will remove the content that is not allowed in the email format and output 'boys '.

 
 
  1. Echo filter_input
    (INPUT_POST, 'email ',
    FILTER_SANITIZE_EMAIL );

The above is the specific function introduction of PHP filter, and I hope it will be helpful to friends who need it.


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.