나는이 연구에 대한 조사를했으며이 문제에 대한 블로그 게시물을 찾지 못했습니다.Facebook JS SDK 공유 수가 증가하지 않음
기본적으로 피드 대화 상자 방법을 사용하여 Zend 앱용 Facebook 공유 버튼을 만들고 있습니다. view.phtml에서
내 HTML은
<div id="fb_share">Share</div>
<?= $this->share->share_count; ?>
<p id='msg'></p>
내 facebook.js 이벤트
$(document).ready(function() {
$('#fb_share').click(function() {
link = window.location.href;
data = {
method: 'feed',
link: link,
name: $('.thesis').html(),
caption: $('.author').html(),
description: $('.body').html()
};
postToFeed(data);
});
});
function postToFeed(data) {
// calling the API ...
var obj = {
method: data['method'],
link: data['link'],
picture: data['picture'],
name: data['name'],
caption: data['caption'],
description: data['description']
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
코드 내 viewAction PHP는 페이스 북과 관련된 니펫을 처리하는
$uri = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getRequestUri();
$fql = "SELECT url, normalized_url, share_count, like_count, comment_count, ";
$fql .= "total_count, commentsbox_count, comments_fbid, click_count FROM ";
$fql .= "link_stat WHERE url = '$uri'";
$apifql="https://api.facebook.com/method/fql.query?format=json&query=".urlencode($fql);
$json=file_get_contents($apifql);
$fbshare = json_decode($json);
$share = $fbshare[0];
//echo($share->share_count);
$this->view->share = $share;
$this->view->uri = $uri;
그래서 공유하는 작품 , share_count는 페이지를 공유 할 때마다 증가하지 않습니다.
내가 누락 된 항목이 있습니까?
를 사용하는 일반적인 방법을 사용하면 공유 수가 증가합니다 – shiva8