电子邮件服务商PHP过滤器

时间:2017-08-17 10:55:28

标签: php email

我想为" gmail-hotmail-yahoo"制作自定义路径用户例如

let yearString = "2017"
let weekOfYearString = "8"

guard let year = Int(yearString), let weekOfYear = Int(weekOfYearString) else {return}
let components = DateComponents(weekOfYear: weekOfYear, yearForWeekOfYear: year)
guard let date = Calendar.current.date(from: components) else {return}

let df = DateFormatter()
df.dateFormat = "yyyy-MM-dd"
let outputDate = df.string(from: date)  //2017-02-19

现在我想要简单的PHP代码来过滤电子邮件服务提供商

  

如果我的电子邮件是 HelloWorld@gmail.com ,请转到/ gmailuser路径

例如

<input type="email" name="email"/>

1 个答案:

答案 0 :(得分:0)

使用stripos查找(无案例)电子邮件是否包含重定向用户所需的关键字:

<?php
$email = $_POST['email'];

if (stripos($email, '@gmail.com') !== false) {
    header('Location: /gmailusers');

   } elseif (stripos($email, '@hotmail.') !== false) {
    header('Location: /liveusers');
} else {
 header('Location: /unknownusers');

}
?>