PHP分页问题,求大神指导
<br>
<br>
<br>
<meta><br>
<br>
<script></script><br>
<script><br />
<br />
function aurl(i){<br />
var url = window.location.href;<br />
if(url.indexOf('?')>0){<br />
url=url.substring(0,url.indexOf('?')) ;<br />
} <br />
url=url+"?page="+i;<br />
document.getElementById("documentForm").action=url;<br />
document.getElementById("insu").click();<br />
}<br />
</script><br>
<br>
Copier après la connexion
$key = $_POST["key"];
if($key=="")
{
echo "请输入搜索条件";
return;
}
//取得页码
$page = @$_GET['page'];
//定义每页显示信息条数
$page_size = 10;
//当页码参数为空时,将页码设为1
if ($page == "")
{
$page = 1;
}
$wsdl="http://pica.chalwin.com/service/JsAccessWebService.asmx?wsdl";
$client = new SoapClient($wsdl);
$param = array('NodeId'=>'1','key'=>$key,'pageIndex'=>$page,'pageSize'=>$page_size);//传参
$ret = $client->NewsSearch($param);//执行获取新闻的方法
//print_r ($ret);
if(isset($ret)&&$ret)
{
foreach($ret->NewsSearchResult->InheritanceNews as $item)
{
echo "\n
\n";
echo "$item->Title | \n";
echo "
";
}
}
else
{
echo 'no user';
}
//总页数
$totalPage = ceil(($item->NewsCount)/$page_size);
//上一页链接
$Prev = $page - 1;
if ($Prev
{
$Prev = 1;
}
//下一页链接
$Next = $page + 1;
if ($Next > $totalPage)
{
$Next = $totalPage;
}
//输出上一页链接
if ($page 1)
{
echo 'First ';
echo 'Prev';
}
else
{
echo 'First';
echo 'Prev';
}
//页码数字链接
//显示的数字个数
$pageNumber = 5;
//页码数算法
$pagebegin = $page - $pageNumber;
if ($page == 1)
{
$pageend = $pageNumber;
}
else
{
$pageend = $page + $pageNumber;
}
if ($pagebegin
{
$pagebegin = 1;
}
if ($pageend > $totalPage)
{
$pageend = $totalPage;
}
//一次向前翻$pageNumber行
if ($page > $pageNumber)
{
echo '';
}
//输出动态生成的页码链接
for ($i = $pagebegin; $i