怎么将用户填写的邮箱转换成邮箱地址啊?如下比如:
邮箱: [email protected] [email protected]
转换成 :http://mail.163.com http://mail.qq.com邮箱:[email protected] [email protected]
转成:http://vip.163.com http://vip.sina.com
非常感谢
邮箱: [email protected] [email protected]
转换成 :http://mail.163.com http://mail.qq.com邮箱:[email protected] [email protected]
转成:http://vip.163.com http://vip.sina.com
非常感谢
echo 'http://' . substr($mail, strpos($mail, '@') + 1);
$_email_url = preg_replace('/^[\w\-\.]+@([\w\-\.]+)([\w\-\.]+)$/','http://mail.$1$2',$_email);
echo $str;
echo 'http://mail.'.substr($mail, strpos($mail, '@')+1);
$_email_url = preg_replace('/^[\w\-\.]+@([\w\-\.]*?)([\w\-\.]+)([\w\-\.]+)$/','http://mail.$1$2$3',$_email);
echo $_email_url;
$_email_url = preg_replace('/^[\w\-\.]+@([\w\-\.]+)([\w\-\.]+)$/','http://$1$2',$_email);
} else {
$_email_url = preg_replace('/^[\w\-\.]+@([\w\-\.]+)([\w\-\.]+)$/','http://mail.$1$2',$_email);
}
'163.com' => 'http://mail.163.com',
'qq.com' => 'http://mail.qq.com',
'vip.163.com' => 'http://vip.163.com',
'vip.sina.com' => 'http://vip.sina.com',
);$email = '[email protected]'; //用户填写的邮箱echo $dict[array_pop(explode('@', $email))];
$_email = '[email protected]';
$_email_url = preg_replace('/^[\w\-\.]+@([vip.]?)([\w\-\.]+)([\w\-\.]+)$/e', "('$1')?'http://$1$2$3':'http://mail.$2$3'", $_email);
echo $_email_url;
嘿嘿... ... 你别说,我也是今天才发现,可能是csdn又坏了.
先用@打断,然后检查@后面那个字符串是否有vip,有的话就是http://vip.163.com
没有的话就是 http://mail.163.com我懒得慌不写代码了。