久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      TP中如何按照周來實(shí)現(xiàn)將數(shù)據(jù)分類

      下面thinkphp框架教程欄目將給大家介紹關(guān)于如何按照周實(shí)現(xiàn)將數(shù)據(jù)分類問題,希望對需要的朋友有所幫助!

      具體問題描述:

      按照周將數(shù)據(jù)分類問題:

      我現(xiàn)在有一個(gè)數(shù)據(jù),是按照每天計(jì)算出來的tp.對應(yīng)的數(shù)據(jù)為

      ["2011-1-1","2011-1-2","2011-1-3","2011-1-4",...]

      每一天對應(yīng)的數(shù)據(jù)(tp)

      [1,2,2,3,...]

      那么現(xiàn)在要講這些日期按照周分類,沒就是計(jì)算的結(jié)果為

      ["2011年第一周",...]

      數(shù)據(jù)為

      [8,...]

      那么現(xiàn)在該怎么做呢?? 用什么語言實(shí)現(xiàn)都無所謂~~~~

      實(shí)現(xiàn)方法:

      <?php $date_list     = null; $num_list     = null; $index = 0; while($index < 20) {     $date_list[] = date('Y-m-d',strtotime('-' . $index . ' day'));     $num_list[] = $index;     $index++; }  // 先別管上面的代碼,只是為了生成你的數(shù)據(jù) $ret_list = null; // 假設(shè)日期數(shù)組和值數(shù)組的索引一致 foreach($date_list as $k => $date) {     if($ret_list[date('W', strtotime($date))]) {         $ret_list[date('W', strtotime($date))] += $num_list[$k];     } else {         $ret_list[date('W', strtotime($date))] = $num_list[$k];     } } echo("日期數(shù)組:<br/>"); print_r($date_list); echo("<br/>");  echo("數(shù)值數(shù)組:<br/>"); print_r($num_list); echo("<br/>");  echo("按周統(tǒng)計(jì)數(shù)組(數(shù)組的鍵就是今年的第幾周):<br/>"); print_r($ret_list);

      推薦:《最新的10個(gè)thinkphp視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)