我正在尝试实现这样的目标,那就是说“X 在 Y 上玩游戏”。
我已经为此工作了好几个小时,但我没有产生任何结果。我搜索了谷歌和其他 stackoverflow 线程,但一无所获。这是我已经拥有的代码:
<script>
function publishStory() {
body = {
name: "<?php echo $userInfo['name']; ?> is playing <?php echo $game['name']; ?>",
link: "http://localhost",
caption: "I'm playing <?php echo $game['name']; ?> at http://localhost/",
message: "Wow! <?php echo $game['name']; ?> is amazing! Come play!",
source: 'http://localhost/static/flash.swf',
image: 'http://google.com/images/logo.gif',
"actions": [{"name":"Play <?php echo $game['name']; ?> now at Localhost","link":"localhost"}],
description: "The fascinating, compelling description"
}
FB.api('/me/feed', 'post', body, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Published to stream - you might want to delete it now!');
}
},
function(response) {
console.log('publishStory response: ', response);
});
return false;
}
</script>
这就是结果:
如您所见,情况完全不同。有人能告诉我如何用“X 在 Y 上玩游戏”来实现发布故事吗?