简体   繁体   English

Facebook PHP SDK 5.0下一页

[英]Facebook php sdk 5.0 next page

The Facebook/Facebook Class got the method next in order to get the next page. Facebook / Facebook类接下来获得了该方法以便获得下一页。

In my case I get a list of all albums, want to loop over all albums and find the id of the cover photos album. 以我为例,我获得了所有相册的列表,想遍历所有相册并找到封面照片相册的ID。 SOme pages got more than 25 Albums, so i need pagination. SOme页面有超过25个相册,所以我需要分页。

But the next method is requesting a GraphEdge. 但是下一个方法是请求GraphEdge。 What should I hand over? 我应该交什么?

(I'll just copy my answer from the FB Deveopers group here, so the question has an answer; and it might perhaps help other people in the future as well.) (我只是在这里复制FB开发人员小组的答案,所以这个问题会有答案;这也许将来也会对其他人有所帮助。)

[I] want to loop over all albums and find the id of the cover photos album. [I]想要遍历所有相册并找到封面照片相册的ID。 SOme pages got more than 25 Albums, so i need pagination. SOme页面有超过25个相册,所以我需要分页。

I think you can have that without pagination: Instead of going through all the user's albums, request their cover photo – and then look what album that is in. 我想您可以不用分页就可以做到这一点:与其浏览所有用户的相册,不如索取他们的封面照片,然后查看其中的相册。

/me?fields=cover – gets you the id of the cover photo. /me?fields=cover –获取封面照片的ID。
Then use that id to request the album – /123456789?fields=album 然后使用该ID请求相册– /123456789?fields=album


I didn't find a way to merge those two into one request using Field Expansion, that doesn't seem to work with the CoverPhoto node type (or I didn't get the syntax right) – but still, two requests (and the first one you'd probably be making anyway, to get other user details) seems a lot better than having to loop over all albums and compare their names, and on top of that having to deal with possible pagination. 我没有找到一种使用Field Expansion将这两个合并为一个请求的方法,该方法似乎不适用于CoverPhoto节点类型(或者我的语法不正确)–但是,仍然有两个请求(以及首先,您可能还是要制作一个(获取其他用户详细信息)似乎要比遍历所有专辑并比较它们的名字好得多,此外,还要处理可能的分页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM