<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>数组分页 &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/%E6%95%B0%E7%BB%84%E5%88%86%E9%A1%B5/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Mon, 01 Oct 2012 09:08:34 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>
	<item>
		<title>php数组分页</title>
		<link>https://www.mudbest.com/%e6%95%b0%e7%bb%84%e5%88%86%e9%a1%b5/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Mon, 29 Aug 2011 06:56:20 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[数组分页]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/788.action</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
&lt;?php
$arr_click = array(
array( 'clicks' =&gt; 3, 'clickDate' =&gt;'2010-10-11' ),
array( 'clicks' =&gt; 2, 'clickDate' =&gt;'2010-10-10' ),
array( 'clicks' =&gt; 3, 'clickDate' =&gt;'2010-10-09' ),
array( 'clicks' =&gt; 4, 'clickDate' =&gt;'2010-10-08' ),
array( 'clicks' =&gt; 5, 'clickDate' =&gt;'2010-10-13' ),
array( 'clicks' =&gt; 7, 'clickDate' =&gt;'2010-10-14' ),
array( 'clicks' =&gt; 6, 'clickDate' =&gt;'2010-10-15' ),
array( 'clicks' =&gt; 9, 'clickDate' =&gt;'2010-10-16' ),
);
//print_r($arr_click);
if(!isset($_GET&#x5B;'page']))
{
    $page = 1;
}
else
{
 $page=$_GET&#x5B;'page'];
}
$size=1;//每页显示的记录数
$pnum = ceil(count($arr_click) / $size);  //总页数，ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$newarr = array_slice($arr_click, ($page-1)*$size, $size);
for($i=0;$i&lt;count($newarr);$i++)
{
 echo $newarr&#x5B;$i]&#x5B;'clickDate'].&quot;&lt;br/&gt;&quot;;
}
?&gt;
</pre>
<pre class="brush: php; title: ; notranslate">
&lt;?php
if(!isset($_GET&#x5B;'page']) || $_GET&#x5B;'page']&lt;=1){
?&gt;
&lt;a href=&quot;doing_date.php?page=1&quot;&gt;上一页&lt;/a&gt;
&lt;?php }else{ ?&gt;
&lt;a href=&quot;doing_date.php?page=&lt;?php echo $page-1;?&gt;&quot;&gt;上一页&lt;/a&gt;
&lt;?php } 
die();
?&gt;
</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
