Home > php教程 > PHP源码 > body text

PHP验证Email和IP地址最简单的方法

WBOY
Release: 2016-06-08 17:21:43
Original
1204 people have browsed it

一个PHP验证Email和IP地址例子,非常的简单好用希望对各位朋友会带来帮助哦。

<script>ec(2);</script>

检查一个用户是否输入了一个有效的email地址,最简单的方法就是使用PHP的内建函数filter_var(),它能够检验email地址。

 代码如下 复制代码

filter_var('sgamgee@example.com', FILTER_VALIDATE_EMAIL);

// Returns "sgamgee@example.com". This is a valid email address.

filter_var('sauron@mordor', FILTER_VALIDATE_EMAIL);

// Returns boolean false! This is *not* a valid email address.

?>

Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!