Chi*_*gde 1 php facebook cakephp-1.3 facebook-opengraph
在蛋糕php 1.3中查看ctp我有以下代码:
$url = 'http://example.com/exmp/explus/books/view/'.$book['Book']['id'];
echo $this->Html->meta(array('property' => 'fb:app_id', 'content' => '*******'),'',array('inline'=>false));
echo $this->Html->meta(array('property' => 'og:type', 'content' => 'book'),'',array('inline'=>false));
echo $this->Html->meta(array('property' => 'og:url', 'content' => $url ),'',array('inline'=>false));
echo $this->Html->meta(array('property' => 'og:title', 'content' => $book['Book']['title']),'',array('inline'=>false));
echo $this->Html->meta(array('property' => 'og:description', 'content' => $book['Book']['title']),'',array('inline'=>false));
$imgurl = '../image/'.$book['Book']['id'];
echo $this->Html->meta(array('property' => 'og:image', 'content' => $imgurl ),'',array('inline'=>false)); ?>
Run Code Online (Sandbox Code Playgroud)
当我发布它时,它会出现以下错误
{
"error": {
"message": "(#3502) Object at URL http://example.com/exmp/explus/books/view/234' has og:type of 'website'. The property 'book' requires an object of og:type 'book'. ",
"type": "OAuthException",
"code": 3502
}
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决它?
如果您的页面受限于登录用户或具有某种会话逻辑,则可能会发生此问题.
您可以使用此链接中的调试工具:
http://developers.facebook.com/tools/debug
在该链接中,您可以在字段中提供您的网址(http://example.com/exmp/explus/books/view/234)"Input URL, Access Token, or Open Graph Action ID".
之后,如果您能够看到值fb:app_id,og:url,og:type,og:title,则单击调试按钮,将不会发生此问题.
另外,您可以查看"URLs"页面底部的部分并单击"See exactly what our scraper sees for your URL"链接.点击链接,您可以在浏览器中看到您网站的HTML代码.这将帮助您调试问题.