PHP:为 Facebook 元数据编码

发布于 2024-09-26 13:21:28 字数 327 浏览 0 评论 0原文

最奇怪的事情:

我试图让 facebook 识别“&”在 字段中签名。

我从数据库中提取内容,在其中进行 urlencode: &变成 & 但 facebook 不会选择编码。除了,当我只是简单地将 & 添加到代码本身时,它会选择它看起来好像它在读取符号的 php 转换时遇到了问题。

有什么想法吗?被这个问题困住太久了。我一直在使用 facebook linter 来测试这一点。

Strangest thing:

I'm trying to get facebook to recognize the "&" sign within the <meta property='og:title' content="data"/> field.

I have content being extracted from a db where I urlencode: & becomes & but facebook doesn't pick up the encoding.. Except, when I just plainly add a & to the code itself, it picks it up.. It seems as though it's specifically having an issue with reading the php conversion of the symbols.

Any idea? Been stuck on this for too long. I've been using the facebook linter to test this.

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

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

发布评论

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

评论(2

游魂 2024-10-03 13:21:28

我建议使用这样的方法:

printf('

', strip_tags(htmlentities("data")));

I recommend using an approach like this:

printf('<meta property="og:description" content="%s" />', strip_tags(htmlentities("data")));

淡莣 2024-10-03 13:21:28

如果没有其他人为您提供准确的解决方案,我认为您可能会从查看原始 HTTP 流量中受益。工具有很多,最低级的是wire shark。

If nobody else gives you an exact fix, I think you might benefit from looking at the raw HTTP traffic. There are lots of tools, the lowest level is wire shark.

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