How to correctly use PHP filter to determine filtered data_PHP tutorial

WBOY
Release: 2016-07-15 13:31:51
Original
820 people have browsed it

If the data is present, the system will completely output ‘boy@163.com’. If it is in the wrong format, such as 'boy', false will be output. If the email field in the form is not filled in, the system outputs null, which is empty.

<ol class="dp-xml"><li class="alt"><span><span>echo filter_input(INPUT_POST, <br>‘email’, FILTER_VALIDATE_EMAIL); </span></span></li></ol>
Copy after login

The fourth, PHP filter filters the content of the input variables according to the requirements

The only difference from the above is the second one If you use FILTER_SANITIZE_EMAIL as the parameter, the output results will be different. Suppose a field email comes through POST of the form.

If it is data similar to 'boy@163.com', the system will completely output 'boy@163.com'. If it is in the wrong format, such as 'boy-afds3', as long as it is numbers, letters, dashes and other content that can appear in the email format, the system will also completely output 'boy-afds3'. If the email field in the form is not filled in, the system outputs null, which is empty. If it is 'boy Asan', the system will remove the things that are not allowed in the email format and output 'boy'.

<ol class="dp-xml"><li class="alt"><span><span>echo filter_input<br>(INPUT_POST, ‘email’, <br>FILTER_SANITIZE_EMAIL);  </span></span></li></ol>
Copy after login

The above is an introduction to the specific functions of PHP filter. I hope it will be helpful to friends who need it again.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446194.htmlTechArticleIn the data, the system will completely output boy@163.com. If it is in the wrong format, such as boy, false will be output. If the email field in the form is not filled in, the system outputs null, that is...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template