{"id":463,"date":"2010-06-24T19:41:19","date_gmt":"2010-06-24T19:41:19","guid":{"rendered":""},"modified":"2010-06-24T19:41:19","modified_gmt":"2010-06-24T19:41:19","slug":"463","status":"publish","type":"post","link":"https:\/\/www.poloo.org\/?p=463","title":{"rendered":"php\u5206\u9875\u4ee3\u7801"},"content":{"rendered":"<p>\u51fd\u6570<br \/><code><br \/>function multi($count, $perpage, $currentpage, $url) {<br \/>&#160;&#160;&#160;&#160;\/\/multi pages<br \/>&#160;&#160;&#160;&#160;if ($count &gt; $perpage) {<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$num = ceil($count \/ $perpage);<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$string = \"&lt;a href=\"\" . BASE_URL . $url . \"&page=1\"\"<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;. ($currentpage == 1 ? \" style=\"font-weight: bold\"\" : \"\") . \"&gt;1&lt;\/a&gt;\";<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for ($i = 2; $i &lt;= $num; $i++) {<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$string .= \" | &lt;a href=\"\" . BASE_URL . $url . \"&page=\" . $i . \"\"\"<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;. ($i == $currentpage ? \" style=\"font-weight: bold\"\" : \"\") . \"&gt;\" . $i . \"&lt;\/a&gt;\";<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return $string;<br \/>&#160;&#160;&#160;&#160;} else {<br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return \"\";<br \/>&#160;&#160;&#160;&#160;}<br \/>}<\/p>\n<p><\/code><br \/>\u8c03\u7528\uff1a<br \/><code><br \/>&lt;PRE class=brush:php&gt;\/\/multi page<br \/>$page = empty($_GET['page']) ? 1 : intval($_GET['page']);<br \/>$perpage = 3;<br \/>$start = ($page - 1) * $perpage;<\/p>\n<p>$multi = multi($count, $perpage, $page, $pageurl);<\/p>\n<p>&lt;\/PRE&gt;<\/p>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u51fd\u6570function multi($count, $perpage,&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-463","post","type-post","status-publish","format-standard","hentry","category-Php"],"_links":{"self":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=463"}],"version-history":[{"count":0,"href":"https:\/\/www.poloo.org\/index.php?rest_route=\/wp\/v2\/posts\/463\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.poloo.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}