cari
Rumahphp教程PHP源码几种不同风格php分页代码(1/8)

<script>ec(2);</script>

function outPege($ps教程,$page)
{
// $ps 累计信息数 $page 当前page数 $max 列表的最大数 $min 列表的最小值
$max      = ($page >= 5)? $page+5:10;
if($max > $ps)$max =$ps;
$min      =($page-5);
if($min if($page>1)$pagelist = "首页";
for($i=$min;$i   $pagelist.= ($i!=$page)? "{$i}":"{$page}";
}
$pagelist.= ($page>=$ps)?'':"尾页";
return $pagelist;
}

//方法二

/**
* 显示分页函数
* records总记录数,currentpage当前页数,rows每页记录数,listpage页号列表长度。
*/
function showpage ($records,$currentpage,$rows=20,$listpages=7) {
if($records if($rows if($listpages $action=$_SERVER['QUERY_STRING']; //得到地址栏中?后的内容
if($action){ //将page=...的内容去掉
$action=preg_replace("/&page[^&]*/","",$action);
$action=preg_replace("/page[^&]*&*/","",$action);
}
if($action)$action.='&';
$maxpage=ceil($records/$rows); //进一法取整得到最大页数。
$middlepage=floor($listpages/2); //舍去法取整得到要显示的页数的一半。
if($currentpage$maxpage)$currentpage=1;
$startpage=$currentpage-$middlepage;
if($maxpage-$currentpage if($startpage $endpage=$startpage+$listpages;
if($endpage>$maxpage)$endpage=$maxpage; //结束页计算完成
if($currentpage!=1){
$pagestr="1 ";
}else{
$pagestr="1 ";
}

首页 1 2 3 4 5 6 7 8 末页
Kenyataan
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
DJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 BlackDJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 BlackSep 04, 2024 am 06:51 AM

DJI has not confirmed any plans to introduce a new action camera yet. Instead, it seems that GoPro will get ahead of its rival this year, having teased that it will introduce two new action cameras on September 4. For context, these are expected to a

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"

Vue项目中如何实现数据的分页和显示优化Vue项目中如何实现数据的分页和显示优化Oct 15, 2023 am 09:27 AM

Vue项目中实现数据的分页和显示优化在Vue项目中,当页面需要展示大量数据时,通常需要进行数据的分页和显示优化以提高用户体验,本文将介绍如何使用Vue实现数据的分页和显示优化,并提供具体的代码示例。一、数据分页数据分页是指将大量数据按照一定的规则分割成多页,并在页面上进行分页显示。Vue项目中可以使用如下步骤来实现数据分页:定义数据源首先,定义一个包含所有数

New DJI Osmo action camera spotted before probable summer 2024 launch to rival recent GoPro and Insta360 releasesNew DJI Osmo action camera spotted before probable summer 2024 launch to rival recent GoPro and Insta360 releasesJul 01, 2024 am 09:49 AM

Almost a year has passed since DJI released the Osmo Action 4 (curr. $299 on Amazon). Since then, the company has focused on its other divisions, including new RS camera gimbals. On top of that, it has introduced various drones as well like the Avata

Insta360 Go 3S: New pocketable 4K action camera released weighing just 39 g with Apple Find My supportInsta360 Go 3S: New pocketable 4K action camera released weighing just 39 g with Apple Find My supportJun 14, 2024 pm 06:05 PM

Insta360hasreleasedanewactioncamera,itssecondoftheyearaftertheInsta360X4(curr.$499.99onAmazon).Asexpected,thecompanyhasintroducedtheGo3S,anupgradedthatGo3thatadds4Kvideorecordingcapabilities.Specifically,whileInst

Microsoft正在推出Windows 11 23H2版本到带有Copilot的发布预览频道Microsoft正在推出Windows 11 23H2版本到带有Copilot的发布预览频道Sep 28, 2023 pm 07:17 PM

每个人都在期待今天的Windows1123H2发布。事实上,Microsoft刚刚启动了对发布预览版的更新,这是正式发布阶段之前最接近的频道。被称为Build22631的Microsoft表示,他们正在推出新的更名聊天应用程序,电话链接和一起玩小部件,这些小部件在过去几个月中已在其他内部渠道中进行了测试。“这个新的更新将具有与Windows11版本22H2相同的服务分支和代码库,并将与所有新宣布的功能累积,包括Windows中的Copilot(预览版),”Microsoft承诺。雷德蒙德官员进一

Vuex状态管理之Action异步操作详解Vuex状态管理之Action异步操作详解Aug 10, 2022 pm 03:29 PM

某些情况,我们希望在Vuex中进行一些异步操作, 比如网络请求, 必然是异步的,这个时候怎么处理呢?下面就给大家介绍Vuex状态管理之Action异步操作,希望对需要的朋友有所帮助!

GoPro releases new Hero 13 Black action camera with new lens mods alongside curious GoPro HeroGoPro releases new Hero 13 Black action camera with new lens mods alongside curious GoPro HeroSep 05, 2024 am 06:45 AM

GoPro has now introduced its annual action camera refresh. Unlike in recent years, the company has decided to release two models. However, it has not returned to 360-degree cameras, despite teasing this time last year that it would replace the Max wi

See all articles

Alat AI Hot

Undresser.AI Undress

Undresser.AI Undress

Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover

AI Clothes Remover

Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool

Undress AI Tool

Gambar buka pakaian secara percuma

Clothoff.io

Clothoff.io

Penyingkiran pakaian AI

AI Hentai Generator

AI Hentai Generator

Menjana ai hentai secara percuma.

Artikel Panas

R.E.P.O. Kristal tenaga dijelaskan dan apa yang mereka lakukan (kristal kuning)
3 minggu yang laluBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Tetapan grafik terbaik
3 minggu yang laluBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Cara Memperbaiki Audio Jika anda tidak dapat mendengar sesiapa
3 minggu yang laluBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: Cara Membuka Segala -galanya Di Myrise
3 minggu yang laluBy尊渡假赌尊渡假赌尊渡假赌

Alat panas

SublimeText3 versi Cina

SublimeText3 versi Cina

Versi Cina, sangat mudah digunakan

DVWA

DVWA

Damn Vulnerable Web App (DVWA) ialah aplikasi web PHP/MySQL yang sangat terdedah. Matlamat utamanya adalah untuk menjadi bantuan bagi profesional keselamatan untuk menguji kemahiran dan alatan mereka dalam persekitaran undang-undang, untuk membantu pembangun web lebih memahami proses mengamankan aplikasi web, dan untuk membantu guru/pelajar mengajar/belajar dalam persekitaran bilik darjah Aplikasi web keselamatan. Matlamat DVWA adalah untuk mempraktikkan beberapa kelemahan web yang paling biasa melalui antara muka yang mudah dan mudah, dengan pelbagai tahap kesukaran. Sila ambil perhatian bahawa perisian ini

VSCode Windows 64-bit Muat Turun

VSCode Windows 64-bit Muat Turun

Editor IDE percuma dan berkuasa yang dilancarkan oleh Microsoft

SublimeText3 versi Inggeris

SublimeText3 versi Inggeris

Disyorkan: Versi Win, menyokong gesaan kod!

Penyesuai Pelayan SAP NetWeaver untuk Eclipse

Penyesuai Pelayan SAP NetWeaver untuk Eclipse

Integrasikan Eclipse dengan pelayan aplikasi SAP NetWeaver.