search
Homephp教程php手册php filter_var 过滤指定数据

php filter_var 过滤指定数据

Jun 13, 2016 am 11:16 AM
filterphpvarandfunctiondesignationdatausageoffilterfilter

 

定义和用法
该filter_var ( )函数的过滤器与一个变量指定的过滤器。

返回过滤数据的成功或FALSE的失败。

语法

filter_var(variable, filter, options)


variable:必需。指定变量过滤 filter:可选。指定编号的过滤器来使用。默认是FILTER_SANITIZE_STRING 。

检查PHP的过滤器完全可能的参考过滤器 过滤器编号可以是一个编号名称(如FILTER_VALIDATE_EMAIL )或身份证号码(如274 )   options:可选。指定一个关联数组的旗帜/选项或一个单一的旗帜/选项。检查每个过滤器的各种可能的选择和旗帜

 

来看看filter_var实例教程

 

 if(!filter_var("someone@example....com", FILTER_VALIDATE_EMAIL))  {  echo("E-mail is not valid");  } else  {  echo("E-mail is valid");  } ?>

 

输出结果.

E-mail is not valid

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)