2017-08-17 81 views
0

我想進行自定義路徑「的Gmail,Hotmail的雅虎」用戶例如電子郵件服務提供商PHP過濾

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

現在我想簡單的PHP代碼來過濾電子郵件服務提供商

如果我的電子郵件是[email protected]去/ gmailuser路徑

例如

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

if ($email == 'gmail email') { 
    header('Location: /gmailusers'); 

    } elseif ($email == 'hotmail email') { 
    header('Location: /liveusers'); 
} else { 
header('Location: /unknownusers'); 

} 
?> 

回答

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'); 

} 
?> 
+0

謝謝主席先生<3 –

+0

我想給予好評,但有。我不聲譽15所以有人投他 –

+0

@rekobeko即使你不能upvote的答案,你可以已經接受它:) – Veve

相關問題