AdminStatisticsController.php 1.0 KB
<?php
/**
 * Created by PhpStorm.
 * User: ruidiudiu
 * Date: 2018/11/21
 * Time: 17:20
 */

namespace app\portal\controller;


use cmf\controller\AdminBaseController;
/**
 * Class AdminStatisticsController
 * @package app\portal\controller
 * @adminMenuRoot(
 *     'name'   =>'数据统计',
 *     'action' =>'index',
 *     'parent' =>'',
 *     'display'=> true,
 *     'order'  => 1,
 *     'icon'   =>'th',
 *     'remark' =>'数据统计'
 * )
 */
class AdminStatisticsController extends AdminBaseController{

    public function index(){

        $week0 = strtotime(date('Ymd',strtotime('-0 week')));//把周日当做是一个礼拜的开始,如果想把周一当做是一个礼拜的开始,就把Sunday换成Mondy
        echo $week0."</br>";

        $week1 = strtotime(date('Ymd',strtotime('-1 week')));
        echo date('Y-m-d H:i:s',$week1);
        $week=array();
        for ($i = 0; $i <= 30; $i++){
            $week[30-$i]=strtotime(date('Ymd',strtotime("-$i week")));
        }
        dump($week);

        return $this->fetch();
    }




}