标签:
首先学东西 要多看手册
用php自带的函数 可以解决一些难解的问题
/**
* Created by JetBrains PhpStorm.
* User: Administrator
* Date: 13-6-11
* Time: 上午11:43
* To change this template use File | Settings | File Templates.
*/
$
array =array (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25);
$page=$_GET[‘page‘]?(int)$_GET[‘page‘]:‘0‘;
$pnum = ceil(count($array) / $size);
$newArray = array_slice($array,($page-1)*$size,$size);
{
echo "<a href=\"array1.php?catid=$key.html\" target=\"_blank\">$val</a>\n";
}
echo "<br/><br/><br/><br/>";
echo "<a href=?>第一页</a>\n";
$str=‘‘;
for($i=1;$i<=$pnum-1;$i++)
{
echo "<a href=\"?page=$i\" target=\"_blank\"";
if($i==$page){echo "style=‘color:red;‘";};
echo ">$i</a>\n\n";
}
echo "<a href=?page=$pnum>最后一页</a>\n";
?>
php实现分页,上一页下一页
标签:
原文地址:http://www.cnblogs.com/yuesha/p/5140031.html