本文整理汇总了PHP中Facebook\Facebook::next方法的典型用法代码示例。如果您正苦于以下问题:PHP Facebook::next方法的具体用法?PHP Facebook::next怎么用?PHP Facebook::next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook\Facebook
的用法示例。
在下文中一共展示了Facebook::next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPaginationReturnsProperResponse
public function testPaginationReturnsProperResponse()
{
$config = array_merge($this->config, ['http_client_handler' => new FooClientInterface()]);
$fb = new Facebook($config);
$request = new FacebookRequest($fb->getApp(), 'foo_token', 'GET');
$graphEdge = new GraphEdge($request, [], ['paging' => ['cursors' => ['after' => 'bar_after_cursor', 'before' => 'bar_before_cursor']]], '/1337/photos', '\\Facebook\\GraphNodes\\GraphUser');
$nextPage = $fb->next($graphEdge);
$this->assertInstanceOf('Facebook\\GraphNodes\\GraphEdge', $nextPage);
$this->assertInstanceOf('Facebook\\GraphNodes\\GraphUser', $nextPage[0]);
$this->assertEquals('Foo', $nextPage[0]['name']);
$lastResponse = $fb->getLastResponse();
$this->assertInstanceOf('Facebook\\FacebookResponse', $lastResponse);
$this->assertEquals(1337, $lastResponse->getHttpStatusCode());
}
示例2: json_encode
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Facebook\Facebook;
$allalbums = array();
$fb = new Facebook(['app_id' => '177197009081544', 'app_secret' => '64a6d7830db5893985cbe0475ce5a9db', 'default_graph_version' => 'v2.4', 'default_access_token' => '177197009081544|64a6d7830db5893985cbe0475ce5a9db']);
//get first page
$fb->get('rolandgarros/albums');
$nextpage = true;
while ($nextpage) {
$something = $fb->getLastResponse();
$items = $something->getDecodedBody()['data'];
if (count($items)) {
$allalbums = array_merge($allalbums, $items);
}
//get next page
$nextpage = $fb->next($something->getGraphEdge());
}
header('content-type: Application/json');
echo json_encode($allalbums);