这是代码
<?php
function is_email($input) {
$email_pattern = "/^([a-zA-Z0-9\-\_\.]{1,})+@+([a-zA-Z0-9\-\_\.]{1,})+\.+([a-z]{2,4})$/i";
if(preg_match($email_pattern, $input)) return TRUE;
}
$emails = "xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com
xx@xx.com";
$split_emails = split("\n",$emails);
$split_n = count($split_emails);
for ($x=0;$x<$split_n;$x++) {
if(is_email($split_emails[$x]){
echo $split_emails[$x];
}
}
?>
我确定该功能可以正常工作,因为我在一封电子邮件中对其进行了测试 ps:$emails 来自“POST Form”,但我对其进行了编辑以将其放在这里,没有 HTML 代码,我猜是拆分中的错误,所以请帮忙?