PHP FILTER_SANITIZE_EMAIL 过滤器

PHP 教程 · 2019-01-25 20:41:55

定义和用法

FILTER_SANITIZE_EMAIL 过滤器删除字符串中所有非法的 e-mail 字符。

该过滤器允许所有的字母、数字以及 $-_.+!*'{}|^~[]`#%/?@&=

  • Name: "email"
  • ID-number: 517

实例


<?php
$var="some(one)@exa\mple.com";
var_dump(filter_var($var, FILTER_SANITIZE_EMAIL));
?>

代码的输出如下所示:


string(19) "someone@example.com"


点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

PHP and MySQL Web Development (3rd Edition) (Developer's Library

PHP and MySQL Web Development (3rd Edition) (Developer's Library

Luke Welling、Laura Thomson / Sams / 2004-09-29 / USD 49.99

We've taken the best and made it even better. The third edition of the best-selling PHP and MySQL Web Development has been updated to include material and code on MySQL 5, PHP 5 and on PHPs object mod......一起来看看 《PHP and MySQL Web Development (3rd Edition) (Developer's Library》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具