PHP encoded email address

WBOY
Release: 2016-07-25 09:07:46
Original
1171 people have browsed it
  1. Using this code, any email address can be encoded as an html character entity to prevent it from being collected by spam programs.
  1. function encode_email($email='info@domain.com', $linkText='Contact Us', $attrs ='class="emailencoder"' )
  2. {
  3. // remplazar aroba y puntos
  4. $email = str_replace('@', '@', $email);
  5. $email = str_replace('.', '.', $email);
  6. $email = str_split($email, 5);
  7. $linkText = str_replace ('@', '@', $linkText);
  8. $linkText = str_replace('.', '.', $linkText);
  9. $linkText = str_split($linkText, 5);
  10. $part1 = '< ;a href="ma';
  11. $part2 = 'ilto:';
  12. $part3 = '" '. $attrs .' >';
  13. $part4 = '';
  14. $encoded = '';
  15. return $encoded;
  16. }
Copy code


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template