{"id":531,"date":"2012-04-13T12:43:04","date_gmt":"2012-04-13T04:43:04","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=531"},"modified":"2012-04-13T12:46:20","modified_gmt":"2012-04-13T04:46:20","slug":"%e5%88%86%e4%ba%ab%e4%b8%a4%e4%b8%aaphp%e5%88%86%e9%a1%b5%e7%b1%bb","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/531","title":{"rendered":"\u5206\u4eab\u4e24\u4e2aphp\u5206\u9875\u7c7b"},"content":{"rendered":"
\u00a0php\u5206\u9875\u7c7b\u7b97\u662fphp\u7f51\u7ad9\u8bbe\u8ba1\u4e2d\u6700\u6700\u5e38\u7528\u7684\u4e00\u4e2a\u7c7b\u4e86\uff0c\u6211\u627e\u5230\u4e86\u4e24\u4e2a\uff0c\u5728\u8fd9\u91cc\u548c\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u3002\u90fd\u662f\u7ecf\u8fc7\u672c\u4eba\u6d4b\u8bd5\u7684\uff0c\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\u3002\u76f4\u63a5\u4e0a\u4ee3\u7801\u4e86\u3002<\/div>\n

1.\u7b2c\u4e00\u4e2aphp\u5206\u9875\u7c7b<\/p>\n

<?php
\nclass Pager
\n{
\n\u00a0\u00a0\u00a0 var $_perPage; \/\/\u6bcf\u4e00\u9875\u8bb0\u5f55\u6570<\/p>\n

\u00a0\u00a0\u00a0 var $_totalItems; \/\/\u603b\u8bb0\u5f55\u6570<\/p>\n

\u00a0\u00a0\u00a0 var $_totalPages; \/\/\u603b\u5171\u9875\u6570<\/p>\n

\u00a0\u00a0\u00a0 var $_currentPage; \/\/ \u5f53\u524d\u9875\u5e8f\u53f7<\/p>\n

\u00a0\u00a0\u00a0 var $_listStart; \/\/\u5f53\u524d\u5934\u6761\u8bb0\u5f55ID<\/p>\n

\u00a0\u00a0\u00a0 var $_listEnd; \/\/\u5f53\u524d\u6700\u540e\u6761\u8bb0\u5f55ID<\/p>\n

\u00a0\u00a0\u00a0 var $_pageStart; \/\/\u7b2c\u4e00\u9875<\/p>\n

\u00a0\u00a0\u00a0 var $_pageEnd; \/\/\u6700\u540e\u9875<\/p>\n

\u00a0\u00a0\u00a0 var $_listPage; \/\/\u5faa\u73af\u663e\u793a\u5f53\u524d\u5206\u9875\u5217\u8868<\/p>\n

\u00a0\u00a0\u00a0 var $_pageData; \/\/\u5f53\u524d\u8981\u663e\u793a\u7684\u8bb0\u5f55<\/p>\n

\u00a0\u00a0\u00a0 var $_linkData; \/\/\u9875\u9762\u4f20\u9012\u7684\u53d8\u91cf<\/p>\n

\u00a0\u00a0\u00a0 var $_startId; \/\/\u4ece\u6570\u636e\u5e93\u8bfb\u51fa\u7684\u542f\u59cbid<\/p>\n

\u00a0<\/div>\n

\u00a0\u00a0\u00a0 function pager($_totalItems, $_perPage, $_linkData)
\n\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_currentPage = max((int)@$_GET[‘pageId’], 1); \/\/\u5f53\u524d\u7684\u9875\u5e8f\u53f7<\/p>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_perPage = $_perPage; \/\/\u6bcf\u4e00\u9875\u8bb0\u5f55\u6570<\/p>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_totalItems = $_totalItems; \/\/\u603b\u8bb0\u5f55\u6570<\/p>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_totalPages = ceil($this->_totalItems \/ $this->_perPage); \/\/\u603b\u9875\u6570<\/p>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_linkData = $_linkData; \/\/\u4f20\u9012\u7684\u53d8\u91cf<\/p>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_listStart = ($this->_currentPage – 1) * $this->_perPage + 1; \/\/\u5f53\u524d\u5934\u6761\u8bb0\u5f55ID<\/p>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_listEnd = ($this->_currentPage != $this->_totalPages) ? $this->_currentPage * $this->_perPage : $this->_totalItems; \/\/\u5f53\u524d\u6700\u540e\u6761\u8bb0\u5f55ID<\/p>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_startId = $this->_listStart -1; \/\/\u4ece\u6570\u636e\u5e93\u8bfb\u51fa\u7684\u542f\u59cbid<\/p>\n

\u00a0\u00a0\u00a0 }<\/p>\n

\u00a0<\/div>\n

\u00a0\u00a0\u00a0 function startId() \/\/ \u4ece\u6570\u636e\u5e93\u8bfb\u51fa\u7684\u542f\u59cbid<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_startId;
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function totalItems() \/\/ \u603b\u8bb0\u5f55\u6570<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_totalItems;
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function totalPages() \/\/ \u603b\u9875\u6570<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_totalPages;
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function listStart() \/\/ \u5f53\u524d\u5934\u6761\u8bb0\u5f55ID<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_listStart;<\/p>\n

\u00a0<\/div>\n

\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function listEnd() \/\/ \u5f53\u524d\u6700\u540e\u6761\u8bb0\u5f55ID<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_listEnd;
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function currentPage() \/\/ \u5f53\u524d\u9875<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_currentPage;
\n\u00a0\u00a0\u00a0 }<\/p>\n

\u00a0<\/div>\n

\u00a0\u00a0\u00a0 function pageStart() \/\/ \u7b2c\u4e00\u9875<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_pageStart = “<a href="”" . $_SERVER[‘PHP_SELF’] . ($this->_linkData) . “&pageId=1><FONT title=\u9996\u9875 face=webdings>9<\/FONT><\/a>”;
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function pageEnd() \/\/ \u6700\u540e\u9875<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_pageEnd = “<a href="”" . $_SERVER[‘PHP_SELF’] . ($this->_linkData) . “&pageId=” . $this->_totalPages . “><FONT title=\u5c3e\u9875 face=webdings>:<\/FONT><\/a>”;
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function upPage() \/\/ \u4e0a\u4e00\u9875<\/p>\n

\u00a0<\/div>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if ($this->_currentPage > 1 and $this->_currentPage <= $this->_totalPages)
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $up = $this->_currentPage-1;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_upPage = “<a href="”" . $_SERVER[‘PHP_SELF’] . ($this->_linkData) . “&pageId=” . $up . “><FONT title=\u4e0a\u9875 face=webdings>7<\/FONT><\/a>”;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function downPage() \/\/ \u4e0b\u4e00\u9875<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $down = $this->_currentPage + 1;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if ($this->_currentPage < $this->_totalPages)
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_downPage = “<a href="”" . $_SERVER[‘PHP_SELF’] . ($this->_linkData) . “&pageId=” . $down . “><FONT title=\u4e0b\u9875 face=webdings>8<\/FONT><\/a>”;<\/p>\n

\u00a0<\/div>\n

\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function listPage() \/\/ \u5faa\u73af\u663e\u793a\u5f53\u524d\u5206\u9875\u5217\u8868<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if ($this->_currentPage <= 5 and $this->_currentPage != “”)
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $start = 1;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if ($this->_totalPages < 10) $end = $this->_totalPages;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else $end = 10;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } elseif (($this->_currentPage + 5) > $this->_totalPages)
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $start = $this->_currentPage – 5;<\/p>\n

\u00a0<\/div>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $end = $this->_totalPages;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $start = $this->_currentPage – 4;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $end = $this->_currentPage + 5;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for($i = $start; $i <= $end; $i++)
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_listPage .= “<a href="”" . $_SERVER[‘PHP_SELF’] . ($this->_linkData) . “&pageId=” . $i . “>” . $i . “<\/a> “;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_listPage;
\n\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0 function jumpPage() \/\/ \u8df3\u8f6c<\/p>\n

\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_jumpPage = “<table border=0 width=100% class=’fonts’><tr><td>\u8df3\u8f6c <select name=’pageId’ style=’height=14px’ onchange=\\”location='” . $_SERVER[‘PHP_SELF’] . ($this->_linkData) . “&pa<\/p>\n

\u00a0<\/div>\n

geId=’+this.value;\\”>”; \/\/\u9875\u9762\u8df3\u8f6c<\/p>\n

\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for($i = 1; $i <= $this->_totalPages; $i++)
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if ($i == $this->_currentPage) $selected = “selected”;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $this->_jumpPage .= “<option value=’$i’ $selected>$i<\/option>”;
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 unset($selected);
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return $this->_jumpPage .= “<\/select> \u9875<\/td><\/tr><\/table>”;
\n\u00a0\u00a0\u00a0 }
\n}
\n?><\/p>\n

\u5e94\u7528\u6548\u679c\u622a\u56fe\uff1a<\/p>\n

\"php\u5206\u9875\u7c7b\"<\/a>
php\u5206\u9875\u7c7b<\/figcaption><\/figure>\n

 <\/p>\n

2.\u7b2c\u4e8c\u4e2aphp\u5206\u9875\u7c7b<\/p>\n

<?php<\/p>\n

class SepPage{
\n\u00a0var $rs;
\n\u00a0var $pagesize;\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u5b9a\u4e49\u6bcf\u9875\u663e\u793a\u7684\u8bb0\u5f55\u6570
\n\u00a0var $nowpage;\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u5f53\u524d\u9875\u7801
\n\u00a0var $array;
\n\u00a0var $conn;
\n\u00a0var $sqlstr;\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u6267\u884c\u7684SQL\u8bed\u53e5
\n\u00a0var $total;
\n\u00a0var $pagecount;\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u603b\u7684\u8bb0\u5f55\u6570
\n\u00a0function ShowDate($sqlstr,$conn,$pagesize,$nowpage){\u00a0\/\/\u5b9a\u4e49\u65b9\u6cd5
\n\u00a0\u00a0$arrays=array();
\n\u00a0\u00a0$array_title=array();
\n\u00a0\u00a0$array_content=array();
\n\u00a0\u00a0if(!isset($nowpage) || $nowpage==”” || $nowpage==0)\u00a0\u00a0\u00a0\/\/\u5224\u65ad\u5f53\u524d\u9875\u53d8\u91cf\u503c\u662f\u5426\u4e3a\u7a7a
\n\u00a0\u00a0\u00a0$this->nowpage=1;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u5b9a\u4e49\u5f53\u524d\u9875\u7684\u503c
\n\u00a0\u00a0else
\n\u00a0\u00a0\u00a0$this->nowpage=$nowpage;\u00a0\u00a0\u00a0\u00a0\/\/\u83b7\u53d6\u5f53\u524d\u9875\u7684\u503c
\n\u00a0\u00a0
\n\u00a0\u00a0$this->pagesize=$pagesize;\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u5b9a\u4e49\u6bcf\u9875\u8f93\u51fa\u7684\u8bb0\u5f55\u6570
\n\u00a0\u00a0$this->conn=$conn;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u8fde\u63a5\u6570\u636e\u5e93\u8fd4\u56de\u7684\u6807\u8bc6
\n\u00a0\u00a0$this->sqlstr=$sqlstr;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u6267\u884c\u7684\u67e5\u8be2\u8bed\u53e5
\n\u00a0\u00a0$this->pagecount=$pagecount;\u00a0\u00a0\u00a0\u00a0\/\/\u603b\u7684\u8bb0\u5f55\u6570
\n\u00a0\u00a0$this->total=$total;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u603b\u7684\u8bb0\u5f55\u6570
\n\u00a0\u00a0
\n\u00a0\u00a0$this->rs=mysql_query($this->sqlstr.”limit “.$this->pagesize*($this->nowpage-1).”,$this->pagesize”,$this->conn);
\n\u00a0\u00a0$this->total=mysql_num_rows($this->rs);\u00a0\u00a0\u00a0\/\/\u83b7\u53d6\u8bb0\u5f55\u6570
\n\u00a0 \u00a0\u00a0if($this->total==0){\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u5224\u65ad\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u4e3a0\uff0c\u5219\u8f93\u51fa\u5982\u4e0b\u5185\u5bb9
\n\u00a0\u00a0\u00a0return false;\u00a0\u00a0
\n\u00a0\u00a0\u00a0 }else{\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u5426\u5219
\n\u00a0\u00a0\u00a0 \u00a0\u00a0if(($this->total % $this->pagesize)==0){\u00a0\u00a0\u00a0\/\/\u5224\u65ad\u5982\u679c\u603b\u7684\u8bb0\u5f55\u6570\u9664\u4ee5\u6bcf\u9875\u663e\u793a\u7684\u8bb0\u5f55\u6570\u7b49\u4e8e0
\n\u00a0\u00a0\u00a0 \u00a0\u00a0$this->pagecount=intval($this->total\/$this->pagesize);\u00a0\/\/\u5219\u4e3a\u53d8\u91cfpagecount\u8d4b\u503c
\n\u00a0\u00a0\u00a0}else if($this->total<=$this->pagesize){
\n\u00a0\u00a0\u00a0\u00a0$this->pagecount=1;\/\/\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u5c0f\u4e8e\u7b49\u4e8e\u6bcf\u9875\u8bb0\u5f55\u6570\uff0c\u90a3\u4e48\u4e3a\u53d8\u91cf\u8d4b\u503c\u4e3a1\u00a0
\n\u00a0\u00a0\u00a0 \u00a0}else{
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0$this->pagecount=ceil($this->total\/$this->pagesize);\u00a0\/\/\u5426\u5219\u8f93\u51fa\u53d8\u91cf\u503c
\n\u00a0\u00a0\u00a0 \u00a0}
\n\u00a0\u00a0\u00a0while($this->array=mysql_fetch_array($this->rs)){
\n\u00a0\u00a0\u00a0\u00a0array_push($array_title,$this->array[title]);
\n\u00a0\u00a0\u00a0\u00a0array_push($array_content,$this->array[content]);
\n\u00a0\u00a0\u00a0}\u00a0\u00a0\u00a0
\n\u00a0\u00a0\u00a0array_push($arrays,$array_title,$array_content);
\n\u00a0\u00a0\u00a0return $arrays;
\n\u00a0\u00a0}
\n\u00a0}
\n\u00a0function ShowPage($contentname,$utits,$anothersearchstr,$class){
\n\u00a0\u00a0$allrs=mysql_query($this->sqlstr,$this->conn);\u00a0\u00a0\/\/\u6267\u884c\u67e5\u8be2\u8bed\u53e5
\n\u00a0\u00a0$record=mysql_num_rows($allrs);
\n\u00a0\u00a0$pagecount=ceil($record\/$this->pagesize);\u00a0\u00a0\/\/\u8ba1\u7b97\u5171\u6709\u51e0\u9875
\n\u00a0\u00a0$str.=”\u5171\u6709”.$contentname.”&nbsp;”.$record.”&nbsp;”.$utits.”&nbsp;\u6bcf\u9875\u663e\u793a&nbsp;”.$this->pagesize.”&nbsp;”.$utits.”&nbsp;\u7b2c&nbsp;”.$this->nowpage.”&nbsp;\u9875\/\u5171&nbsp;”.$pagecount.”&nbsp;\u9875”;
\n\u00a0\u00a0$str.=”&nbsp;&nbsp;&nbsp;&nbsp;”;
\n\u00a0\u00a0$str.=”<a href="”".$_SERVER[‘PHP_SELF’].”?page=1″.$anothersearchstr.”>\u9996\u9875<\/a>”;
\n\u00a0\u00a0$str.=”&nbsp;”;
\n\u00a0\u00a0if(($this->nowpage-1)<=0){
\n\u00a0\u00a0\u00a0$str.=”<a href="”".$_SERVER[‘PHP_SELF’].”?page=1″.$anothersearchstr.”>\u4e0a\u4e00\u9875<\/a>”;
\n\u00a0\u00a0}else{
\n\u00a0\u00a0\u00a0$str.=”<a href="”".$_SERVER[‘PHP_SELF’].”?page=”.($this->nowpage-1).$anothersearchstr.”>\u4e0a\u4e00\u9875<\/a>”;
\n\u00a0\u00a0}
\n\u00a0\u00a0$str.=”&nbsp;”;\u00a0
\n\u00a0\u00a0if(($this->nowpage+1)>=$pagecount){
\n\u00a0\u00a0\u00a0$str.=”<a href="”".$_SERVER[‘PHP_SELF’].”?page=”.$pagecount.$anothersearchstr.”>\u4e0b\u4e00\u9875<\/a>”;
\n\u00a0\u00a0}else{
\n\u00a0\u00a0\u00a0$str.=”<a href="”".$_SERVER[‘PHP_SELF’].”?page=”.($this->nowpage+1).$anothersearchstr.”>\u4e0b\u4e00\u9875<\/a>”;
\n\u00a0\u00a0}
\n\u00a0\u00a0$str.=”&nbsp;”;
\n\u00a0\u00a0\u00a0$str.=”<a href="”".$_SERVER[‘PHP_SELF’].”?page=”.$pagecount.$anothersearchstr.”>\u5c3e\u9875<\/a>”;
\n\u00a0\u00a0if(count($this->array)==0 || $this->rs==false)\u00a0\u00a0\u00a0
\n\u00a0\u00a0\u00a0return “”;
\n\u00a0\u00a0else
\n\u00a0\u00a0\u00a0\u00a0\u00a0 return $str;\u00a0
\n\u00a0}
\n}<\/p>\n

?><\/p>\n

\u5e94\u7528\u6548\u679c\u622a\u56fe\uff1a<\/p>\n

\"php-\u5206\u9875\u7c7b\"<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

\u00a0php\u5206\u9875\u7c7b\u7b97\u662fphp\u7f51\u7ad9\u8bbe\u8ba1\u4e2d\u6700\u6700\u5e38\u7528\u7684\u4e00\u4e2a\u7c7b\u4e86\uff0c\u6211\u627e\u5230\u4e86\u4e24\u4e2a\uff0c\u5728\u8fd9\u91cc\u548c\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u3002\u90fd\u662f\u7ecf\u8fc7\u672c\u4eba\u6d4b\u8bd5\u7684\uff0c\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\u3002\u76f4\u63a5\u4e0a\u4ee3\u7801\u4e86\u3002 1.\u7b2c\u4e00\u4e2aphp\u5206\u9875\u7c7b <?php class Pager { \u00a0\u00a0\u00a0 var $_perPage; \/\/\u6bcf\u4e00\u9875\u8bb0\u5f55\u6570 \u00a0\u00a0\u00a0 var $_totalItems; \/\/\u603b\u8bb0\u5f55\u6570 \u00a0\u00a0\u00a0 var $_totalPages; \/\/\u603b\u5171\u9875\u6570<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,9],"tags":[84],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/531"}],"collection":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/comments?post=531"}],"version-history":[{"count":10,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/531\/revisions"}],"predecessor-version":[{"id":539,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/531\/revisions\/539"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=531"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}