/ PHP / 상세보기

Encode email

👁 조회 3,612 📅 2009-09-01
function encode_email($e)
{
 for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
 return $output;
}


echo(encode_email('user@davidwalsh.name'));

💬 댓글 2개

2009-10-14
참조사이트 : http://davidwalsh.name/php-email-encode-prevent-spam
2010-03-01
// email 주소 일부 암호화
function encode_mail_form($email, $encode_count=2, $fields='*')
{
$mail=explode("@",$email);
$email=substr($mail[0],0,$encode_count).str_repeat($fields,strlen($mail[0]))."@".$mail[1];

return $email;
}