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 &
but fa开发者_StackOverflowcebook 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.
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.
精彩评论