开发者

PHP: encoding meta data for Facebook

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 &amp; but fa开发者_StackOverflowcebook doesn't pick up the encoding.. Except, when I just plainly add a &amp; 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.


I recommend using an approach like this:

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜