【发布时间】:2013-05-22 09:01:35
【问题描述】:
首先让我说我是编码新手,所以我很可能错过了绝对基础知识...
我正在处理一个 phtml 文件(由专业人员完成)并尝试显示不同 Facebook 页面的点赞数。
执行此操作的查询如下: https://api.facebook.com/method/fql.query?query=selectlike_count from link_stat where url='https://www.facebook.com/'&format=json
为了做到这一点,我尝试更改我找到的以下代码
$fql_query_url = 'https://graph.facebook.com/'
. 'fql?q=SELECT+uid2+FROM+friend+WHERE+uid1=me()'
. '&access_token=' . $access_token;
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
像这样:
$fql_query_url = 'https://graph.facebook.com/'
. 'fql?q=select like_count from link_stat where url='https://www.facebook.com/'&format=json';
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
我将其放入脚本中,然后尝试调用该变量,但收到“未定义变量”错误。
我不知道我做错了什么...... 代码没问题吗? 它是在脚本中,在 php 代码块中还是在其他东西中? 我是否正确调用了变量?
对不起,如果这里有任何废话,正如我所说,我只是进入它...... 感谢您的回复
【问题讨论】: