0
我需要在類別股Facebook的每個記錄數量帶來不工作計數器份額
我把這個代碼:
<?php
function getFacebookDetails($url){
$rest_url = "http://api.facebook.com/restserver.php?format=json&method=links.getStats&urls=".urlencode($url);
$json = json_decode(file_get_contents($rest_url),true);
return $json;
}
$data = getFacebookDetails("http://mycodingtricks.com/html5/html5-inline-edit-with-mysql-php-jquery-and-ajax/");
$shares = $data[0]['share_count'];
$comments = $data[0]['comment_count'];
$likes = $data[0]['like_count'];
echo "Total Shares: ".$shares;
echo "Total Likes: ".$likes;
echo "Total Comments: ".$comments;
?>
這就是我出去: http://i.stack.imgur.com/B17V4.png
計數器只出現在一個地方。 告訴我如何做到這一點,如果他曾經在該類別的每個記錄?
這是字符串產生的錯誤。此代碼我content.php註冊 http://i.stack.imgur.com/wyUtV.png
謝謝。有用。 告訴我,我該如何取代它:http://mycodingtricks.com/html5/html5-inline-edit-with-mysql-php-jquery-and-ajax/上的帖子鏈接 我把它放在<?php the_permalink(); ?>',但它不起作用 –
嗨,試試這個。 '$ link = get_permalink(); $ data = getFacebookDetails($ link);' –