如何解码电子邮件?

发布于 2024-12-20 11:10:05 字数 265 浏览 2 评论 0原文

我正在抓取一页,其中有类似的电子邮件<代码>...&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#83;&#116 ;& ;#101;&#119;&#97;&#114;&#116;&#46;&#83;&#109;&#105;&#1.. .和类似的。它已被解码,我如何用 PHP 对其进行编码?谢谢(仅用于教育目的)。

I am scraping one page and it has e-mails like ...mailto:Stewart.Smi... and similar. It is decoded, how could I encode it with PHP? Thanks (only for education purposes).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

决绝 2024-12-27 11:10:05

这些只是普通的 ASCII 字符,由于神秘的原因,它们被编码为 HTML 数字字符格式。即字母“a”被编码为`

常用编码列表

内置 php 函数 常见 编码列表 php.net/manual/en/function.html-entity-decode.php" rel="nofollow">html-entity-decode() 应该将它们转换回可读的 utf-8。

These are just ordinary ASCII characters which for mysterious reasons have been encoded in HTMLs numeric character format. i.e. the letter "a" is coded as `.

A list of common encodings

The built in php function html-entity-decode() should convert these back to readable utf-8.

倒数 2024-12-27 11:10:05

尝试 html_entity_decode() 获取编码值。

例如:

$str = "mailto";  
$string = html_entity_decode($str);
echo $string;

try html_entity_decode() to get the encoded value.

for ex:

$str = "mailto";  
$string = html_entity_decode($str);
echo $string;
北方的巷 2024-12-27 11:10:05

每个实体都是一个字符的十进制表示。此 Perl 代码将转换简单的 ASCII。

use strict;
use warnings;

my $mail = 'mailto:Stewart.Smi';

$mail =~ s/&#(\d+);/chr $1/eg;

print $mail;

输出

mailto:Stewart.Smi

Each entity is the decimal representation of a character. This Perl code will translate simple ASCII.

use strict;
use warnings;

my $mail = 'mailto:Stewart.Smi';

$mail =~ s/&#(\d+);/chr $1/eg;

print $mail;

OUTPUT

mailto:Stewart.Smi
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文