大神帮我看下,我的查询分页类哪里错了分页类
<br> 这是page.class.php<br> <?php <br /> class DividePage{//分页类<br> private $total;//要显示的总记录数<br> private $url;//请求的URL地址<br> private $displaypg;//每页显示的记录数,默认为每页显示10条记录<br> private $page;//当前页码<br> private $lastpg;//总页数,即最后一页的页码<br> private $prepg;//前一页<br> private $nextpg;//后一页<br> private $firstcount;//记录条数开始的序号从0开始<br> private $startd;//记录条数开始的记录号.<br> private $stopd;//记录条数结束的记录号.<br> <br> //构造函数<br> public function __construct($url, $total, $displaypg){<br> $this->url = $url;//请求的URL<br> $this->total = $total;//总记录数<br> //if($displaypg == '')<br> $this->displaypg = $displaypg;//每页显示的记录数<br> $this->initDividePage();//初始化分页类<br> //echo ','.$this->displaypg;<br> }<br> <br> //初始化分页类<br> private function initDividePage(){<br> //分析URL<br> $parse_url = parse_url($this->url);//将URL解释为有固定键值对的数组<br> $url_query = $parse_url['query'];//取出URL中的查询字符串<br> if($url_query){//如果有查询字符串,则删除查询字串中当前页的查询字段如:&page=$page或page=$page<br> ereg('(^|&)page=([0-9]*)', $url_query, $k);<br> $this->page = $k[2];//取得当前页的值<br> $url_query = ereg_replace("(^|&)page=$this->page", '', $url_query);//删除查询字串中当前页的查询字段如:&page=$page或page=$page<br> $this->url = str_replace($parse_url['query'], $url_query, $this->url);//保留其他的查询字串,<br> $this->page = $this->page ? $this->page : 1;//如果查询字符串中没有当前页的值就设当前页为1<br> if($url_query){//如果有其他查询字符串,则以&page=$page形式添加翻页查询字串<br> $this->url .= '&page';<br> }else{//如果没有其他查询字串,则以page=$page形式添加翻页查询字串<br> $this->url .= 'page';<br> }<br> }else{//如果没有查询字串,则在URL后添加?page=$page形式的翻页查询字串<br> $this->page = 1;<br> $this->url .= '?page';<br> }<br> $this->lastpg = ceil($this->total / $this->displaypg);//计算总页数,即最后一页的页码<br> $this->page = min($this->lastpg, $this->page);//如果当前页大于总页数,则当前页为最后一页的页码<br> $this->prepg = $this->page - 1;//上一页为当前页减一<br> $this->nextpg = $this->page + 1;//(($this->page == $this->lastpg) ? $this->lastpg : ($this->page + 1));//下一页为当前页加一,如果当前页为最后一页,则下一页为0<br> $this->firstcount = ($this->page - 1) * $this->displaypg;//计算当前页,记录条数开始的记录号,从0开始.<br> $this->startd = $this->total ? ($this->firstcount + 1) : 0;//记录开始号从1开始<br> $this->stopd = min($this->firstcount + $this->displaypg, $this->total);//记录结束号<br> //echo $this->displaypg;<br> //echo $this->nextpg.'+=+='.$this->lastpg;<br> }<br> <br> public function getPageInfo(){//取得当前页面的基本信息,如:显示第 1-10 条记录,共 23 条记录。<br> return '<span>显示第<span>'.$this->startd.'-'.$this->stopd.'</span>条记录,共<span>'.$this->total.'</span>条记录。</span>';<br> }<br> <br> public function getCommonPageNav(){//取得通常的分页导航,如:首页 上一页 下一页 尾页<br> $commonnav = '';<br> if($this->lastpg == 1){//如果只有一页,则返回翻页导航,退出,不显示下一页,上一页等。。。<br> return $commonnav;<br> break;<br> }<br> $commonnav = '<a>url.'=1" class="compagestyle">首页</a>';//设置首页导航,page=1<br> if($this->prepg){<br> $commonnav .= '<a>url.'='.$this->prepg.'" class="compagestyle">上一页</a>';<br> }else{ <div class="clear"> </div>

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

WebStorm Mac version
Useful JavaScript development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.