Php 从外部链接分页

Php 从外部链接分页,php,Php,好吧,我不知道该怎么做,我有一个MySQL查询的分页系统,但我一直在思考如何将20个外部链接结果,或者即使我做了50个,变成每页10个结果 我现在使用的代码如下: error_reporting(E_ALL); $feedURL = 'http://gdata.youtube.com/feeds/api/users/sentuamsg/uploads?max-results=20'; $sxml = simplexml_load_file($feedURL); $i=0; foreach ($s

好吧,我不知道该怎么做,我有一个MySQL查询的分页系统,但我一直在思考如何将20个外部链接结果,或者即使我做了50个,变成每页10个结果

我现在使用的代码如下:

error_reporting(E_ALL);
$feedURL = 'http://gdata.youtube.com/feeds/api/users/sentuamsg/uploads?max-results=20';
$sxml = simplexml_load_file($feedURL);
$i=0;
foreach ($sxml->entry as $entry) {
  $media = $entry->children('media', true);
  $watch = (string)$media->group->player->attributes()->url;
  $thumbnail = (string)$media->group->thumbnail[0]->attributes()->url;

parse_str( parse_url( $watch, PHP_URL_QUERY ), $my_array_of_vars );

echo "presentation of the result goes here";

$i++; if($i==5) { 

$i=0; 
 } 
}

有人知道我怎么做吗?

Youtube Gdata API有一个名为start index的变量。 您可以创建一个基于php的函数来检测当前页面,并将其放入变量+1中

就像

当前页面

第二页

这就是逻辑。每一页,+20分为数值。例如,如果你想展示20个结果