在fql查询中使用变量

时间:2012-01-19 07:08:19

标签: facebook facebook-like facebook-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'];

有人可以告诉我,我在这里看到了什么吗?

1 个答案:

答案 0 :(得分:0)


$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'];