Home > Backend Development > PHP Tutorial > Free guestbook About the paging code of the text guestbook

Free guestbook About the paging code of the text guestbook

WBOY
Release: 2016-07-29 08:33:54
Original
950 people have browsed it

//When writing a file, use "|||" to separate each record, and "||" to separate each field in the record
//For example, record one is represented as $str1=$name." ||".$pass."||".$title."||".$message."||".…………
//Then use when connecting record one and record two, $str=$str1. "|||".$str2."|||.………
//The final generated file is as follows
//Flying Fox||450948643||This is the topic||This is the message content||1||| Flying Fox||450948643||This is the topic||This is the message content||2|||Flying Fox||450948643||This is the topic||This is the message content||3|||Flying Fox||450948643| |This is the topic||This is the message content||4|||Flying Fox||450948643||This is the topic||This is the message content||5|||Flying Fox||450948643||This is the topic|| This is the message content||6|||Flying Fox||450948643||This is the topic||This is the message content||7|||Flying Fox||450948643||This is the topic||This is the message content|| 8|||Flying Fox||450948643||This is the topic||This is the message content||9|||Flying Fox||450948643||This is the topic||This is the message content||10|||Flying Fox ||450948643||This is the topic||This is the message content||11|||Flying Fox||450948643||This is the topic||This is the message content||12|||Flying Fox||450948643||This is the topic||This is the message content||13|||Flying Fox||450948643||This is the topic||This is the message content||14|||Flying Fox||450948643||This is the topic||This is Message content||15|||Flying Fox||450948643||This is the topic||This is the message content||16|||Flying Fox||450948643||This is the topic||This is the message content||17| ||Flying Fox||450948643||This is the topic||This is the message content||18|||Flying Fox||450948643||This is the topic||This is the message content||19|||Flying Fox|| 450948643||This is the topic||This is the message content||20|||Flying Fox||450948643||This is the topic||This is the message content||21|||Flying Fox||450948643||This is the topic ||This is the message content||22|||Flying Fox||450948643||This is the topic||This is the message content||23|||
//Then start to get the data in the file, the program list is as follows
$end="|||"; //Record delimiter, determined by the symbol used when writing files
$mid="||"; //Field delimiter, same as above
$temp=file("messageboard.info" ); //Read the file content into an array
$temp=join("",$temp); //Convert the read array into a string
$mess=explode($end,$temp); //Split Out the record
$num=count($mess);                                                                                                 use using using ’ using ’ s ’ to ’ using ’ to divulge ’ to ’ using ’ to ’ ’ to ’ ’ to ’ ’ to ’ ’         out out out out out out out out out out out off out out out out out out over over over over over over over over over over over through to to through through through through through through through through through through through through through through through through through from to to to to to to to toverse upon come date 🎉 ; Whole
else if ($num/$row>=floor($num/$row)) $page=floor($num/$row)+1; //If the total number of rows divided by each page is greater than the number of transactions, Just round up and add one.
else if ($num/$row<=floor($num/$row)) $page=floor($num/$row); //If it is smaller than rounding, round it up
$minnum=($dpage -1)*$row; //The current page starts fetching records from this number
$maxnum=$row*$dpage; ;$i++)
{
$message=explode($mid,$mess[$i]); //Split out the fields in the record
$num1=count($message); In the control loop (for ($ j = 0; $ j & lt; $ num1; $ j ++) {

m m [$ j]. "" // Shows a element in the array at a time.H}
echo "& lt; br & gt;"; ";
}
// Below starting pages
if ($ page & gt; = 2 && $ dpage == 1) //
{ $paged=$dpage+1; echo "Previous pageNext page< ;/a>
"; }
else if ($page>=2&&$dpage>=$page) //If the total number of pages is greater than two pages, and the current page is less than the total number of pages
{ $pageu=$ dpage-1; echo "
Previous page Next page< /font>
"; }
else if ($page>=2&&$dpage>=1&&$dpage<$page) //If the total number of pages is greater than two pages, and the current page is greater than one and less than the total number of pages
{ $pageu=$dpage-1;$paged=$dpage+1;echo "Previous page < ;a href='2.php?&dpage=".$paged."'>Previous page
";}
//If there is only one page
else echo " Previous page Previous page 】

The above introduces the paging code of the free guestbook and the text guestbook, including the content of the free guestbook. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template