我正在编写一个网络爬虫工具来收集电子邮件地址。下载 HTML 内容并使用 DomCrawler
解析后,我得到了这个节点值:
<!--
document.write("<a rel='nofollow' href='mailto:hieubdshappy@gmail.com'>hieubdshappy@gmail.com");
//-->This email address has been protected. You need to enable JavaScript to view the content.
我如何解码它?
最佳答案
该值只是原始字符串中字符的 html 编码值,因此在 PHP 中您可以使用 html_entity_decode 获取原始文本。
$returnValue = html_entity_decode('mailto:hieubdshappy@gmail.com'>hieubdshappy@gmail.com', ENT_COMPAT);
关于javascript - 解码 JavaScript 编码的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45125266/