PHP

Encode email
  • 조회수 3,336
  • 작성일 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'));

  • Comment 2009-10-14 13:50
참조사이트 : http://davidwalsh.name/php-email-encode-prevent-spam
  • Comment 2010-03-01 18:10
// 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;
}