在 fql 查询中使用变量
这里有一些语法问题。尝试使用如下变量在任何页面上获取相似计数:
$url = "http://www.my-domain.com"
$result = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT total_count from link_stat where url ="$url";
));
$fb_fans = $result[0]['total_count'];
但是,当我将 $url 替换为实际值时,它会起作用:
$result = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT total_count from link_stat where
url ="http://www.my-domain.com";
));
$fb_fans = $result[0]['total_count'];
有人能告诉我我在这里明显忽略了什么吗?
Having some problems with syntax here. Trying to get like counts on any page using a variable like so:
$url = "http://www.my-domain.com"
$result = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT total_count from link_stat where url ="$url";
));
$fb_fans = $result[0]['total_count'];
However it works when I replace $url with the actual value as such:
$result = $facebook->api(array(
'method' => 'fql.query',
'query' => 'SELECT total_count from link_stat where
url ="http://www.my-domain.com";
));
$fb_fans = $result[0]['total_count'];
Can someone tell me what I am obviously over looking here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)