Facebook新的PHP SDK for Graph API - 多查询 [英] Facebook New PHP SDK For Graph API - Multi Query

查看:129
本文介绍了Facebook新的PHP SDK for Graph API - 多查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的智慧结束中,查询参数值应该是什么样子的。因此,为了对图形API库进行多重查询,以下是执行它的代码方法,就我所知。

  $ param = array(
'method'=>'fql.multiquery',
'queries'=> $ multiQuery,
'callback '=>'');
$ queryresults = $ facebook-> api($ param);

在Facebook的新PHP SDK库中使用这种方法,有没有人做这个工作?如果是这样,你可以放下一个例子,说明如何构建$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $我一直在努力这几天,我只是找到旧的PHP库的例子。

解决方案

为什么总是在你的头脑for for for for days days,,,,,,。。。。,,,,and and and and and 5分钟后,



所以这里是我可爱的经历。



由于在PHP中,您可以使用 / '字符开始一个文本字符串,我的自我卡在双引号字符和单引号字符的翻转在我看来,多查询中定义的查询是duh,用双引号括起来。



所以学习了一些教训?如果你有一个where子句,使用一个字符串值在一个多查询中,确保为了pete的缘故,您使用SINGLE QUOTES围绕你的过滤字符串值。



BAD BAD - 这是我做的。周围myvalue和myothervalue。NAUGHTY!

  $ multiQuery = 
query1:从某个位置选择一些东西,其中somecolumn =myvalue
query2:从某个位置选择某物,其中somecolumn =myothervalue
};

好的例子 - 现在看看myvalue和myothervalue。

  $ multiQuery = {
query1:select something from something where somecolumn ='myvalue',
query2:从某物中选择某物,其中somecolumn ='myothervalue'
};

所以现在我可以...

  $ multiQuery = {
query1:select something from something where somecolumn ='myvalue',
query2 从某个地方选择某物,其中somecolumn ='myothervalue'
};

$ param = array(
'method'=>'fql.multiquery',
'queries'=> $ multiQuery,
'callback'= >'');
$ queryresults = $ facebook-> api($ param);

如果有人想知道什么是 $的实际类型multiQuery 变量是(对于像我这样的新手),它只是一个字符串数据类型。它不是一个数组,没有比文本更漂亮。


I'm at my wits end in what the queries parameter value should look like. So to sumbit a multiquery accross the graph API library, the following would be the code method to perform it, as far as I can tell.

$param = array(
 'method' => 'fql.multiquery',
 'queries' => $multiQuery,
 'callback' => '');
$queryresults = $facebook->api($param);

Using this method in the new PHP SDK library from Facebook, has any one made this work? If so can you drop an example on how you build the complete value of the $multiQuery variable?

I've been struggeling with this for a few days and I'm only finding exmaples with the old PHP library.

解决方案

Why is it always after banging your head for days, you ask a question, and 5 minutes later, you come up with the answer your self.

So here was MY lovely experience.

Since in PHP you can use a "/' character to start a text string, I got my self stuck in the flip flopping of the double quote character and single quote character. It dawned on me that the queries defined in a multi query are, duh, wrapped by double quotes.

So lesson learned? If you have a where clause that uses a string value in a multi query, make sure for pete's sake you use SINGLE QUOTES around the string value your filtering on.

BAD BAD - This is what I did. note the double quotes around myvalue and myothervalue. NAUGHTY!

$multiQuery = {
     "query1":"select something from something where somecolumn = "myvalue"",
     "query2":"select something from something where somecolumn = "myothervalue""
     };

GOOD Example - Now look at myvalue and myothervalue.

$multiQuery = {
     "query1":"select something from something where somecolumn = 'myvalue'",
     "query2":"select something from something where somecolumn = 'myothervalue'"
     };

So now I can...

$multiQuery = {
         "query1":"select something from something where somecolumn = 'myvalue'",
         "query2":"select something from something where somecolumn = 'myothervalue'"
         };

$param = array(       
     'method' => 'fql.multiquery',       
     'queries' => $multiQuery,       
     'callback' => '');       
$queryresults = $facebook->api($param);

And if any of you are wondering what is the actual type of the $multiQuery variable is (for newbie like me), it's just a string data type. It's not an array, nothing more nifty than text.

这篇关于Facebook新的PHP SDK for Graph API - 多查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆