php分页有关问题(急)
时间:2021-07-01 10:21:17
帮助过:3人阅读
php分页问题(急)
从数据库读出来的数据如下:
Array
(
[p_id] => 8
[title] => 高清测试2--我的家居
[d_type] => 0
[c_type] => 29
[user_id] => 50
[photo] => Array
(
[0] => http://club.verygood.cn/images/200907/124730234366319.jpg
[1] => http://club.verygood.cn/images/200907/1247302347826.jpg
[2] => http://club.verygood.cn/images/200907/12473023511645.jpg
[3] => http://club.verygood.cn/images/200907/124730235428109.jpg
[4] => http://club.verygood.cn/images/200907/124730235763130.jpg
[5] => http://club.verygood.cn/images/200907/12473023620.jpg
)
[top_times] => 0
[views] => 39
[favorite] => 0
[brief] => 高清测试2--我的家居
[project_id] => 0
[tags] =>
[photo_check] => 1
[clear] => 1
[money] => 0
[download_times] => 0
[average] => 0
[add_time] => 1247302371
[img_url] => http://club.verygood.cn/images/200907/124730234366319.jpg
[img_128] => http://club.verygood.cn/images/200907/124730234366319_128.jpg
[img_512] => http://club.verygood.cn/images/200907/124730234366319_512.jpg
[img_str] => http://club.verygood.cn/images/200907/124730234366319.jpg,http://club.verygood.cn/images/200907/1247302347826.jpg,http://club.verygood.cn/images/200907/12473023511645.jpg,http://club.verygood.cn/images/200907/124730235428109.jpg,http://club.verygood.cn/images/200907/124730235763130.jpg,http://club.verygood.cn/images/200907/12473023620.jpg
)
想在页面显示图片,图片数组是::[photo] => Array
(
[0] => http://club.verygood.cn/images/200907/124730234366319.jpg
[1] => http://club.verygood.cn/images/200907/1247302347826.jpg
[2] => http://club.verygood.cn/images/200907/12473023511645.jpg
[3] => http://club.verygood.cn/images/200907/124730235428109.jpg
[4] => http://club.verygood.cn/images/200907/124730235763130.jpg
[5] => http://club.verygood.cn/images/200907/12473023620.jpg
)
问题是:想在每页显示一张图片,首页显示[0] => http://club.verygood.cn/images/200907/124730234366319.jpg
以此类推:怎么样去实现分页
------解决方案--------------------
利用数组分页啊,代码太多,看起来怪怪的.
大概意思明白,每页显示,那么,利用url传值.然后取相应值判断后,用数组分割一个个取不就好了.没必要全部取吧.
------解决方案--------------------
可以参考一些开源代码的分页函数
------解决方案--------------------
看php100的视频上面有
------解决方案--------------------
根据URL传值,
xxx.php?page=1 对应 [0]
xxx.php?page=2 对应 [1]
.........
------解决方案--------------------
对啊,看下开源的。dz的不错