我是 php 的初学者。每当我尝试在 pear 中实现 Pager 类时,我都会收到此错误
不应在第 21 行的 D:\xampp\htdocs\sam\temp\youtube_playlist.php 中静态调用非静态方法 Pager::factory()
我的代码是
<?php
include("header.php");
include("connect.php");
//connect to db to get video data
$qr = mysql_query("SELECT vid FROM videos",$con);
$data="";
while($row = mysql_fetch_array($qr))
{
$data[]=$row['vid'];
}
//pageing
require('Pager/Pager.php');
$pg_op= array(
'itemData'=>$data,
'append' => true,
'perPage' => 3,
'mode' => 'Sliding',
'delta' => 2
);
$pager = Pager::factory($pg_op);
$pdata = $pager -> getPageData();
$plinks = $pager -> getLinks();
//Display the video
foreach ($pdata as $vd)
{
?>
<iframe width="510" height="265" src="http://www.youtube.com/embed/<?php echo $vd; ?>" frameborder="0" allowfullscreen></iframe>
<?php
}
echo "<br />";
echo $plinks['all'];
include("footer.php");
?>
请帮忙