mStartm = strtotime(date('Y-m-d',time())); $this->mEndtm = $this->mStartm + 86400 - 1; } public function testWeek() { $date = date('Y-m-d',time()); $cur_time = strtotime(date('Y-m-d',time())) + 86400; $start = $cur_time - 86400 * 7; $end = $cur_time -1; $v = ($end - $start + 1) / 86400; } public function testMonth() { $cur = time(); $cur_date = new DateTime(); $cur_date->setTimestamp($cur); $inter = new DateInterval('P1M'); $cur_date->sub($inter); $time = $cur_date->getTimestamp(); } public function testLastsec() { $expried_secs = 10 * 24 * 3600; $usable_time = time() + $expried_secs; $cur_date = date('Y-m-d H:i:s',$usable_time); $cur_time = strtotime(date('Y-m-d',$usable_time)) + 86399; $curx_date = date('Y-m-d H:i:s',$cur_time); $cur_time = util::last_day_secs($usable_time); $cury_date = date('Y-m-d H:i:s',$cur_time); $delta = $usable_time - $cur_time; } public function testRange() { $ltm = localtime(strtotime('2020-09-28'),true); } private function year_day() { $ltm = localtime(strtotime('2020-09-28'),true); return $ltm['tm_yday']; } public function testPeriod() { $date = date('Y-m-d',time()); $period = ['start' => '08:30']; $day_start = strtotime("{$date} {$period['start']}"); if(empty($period['end'])) { $day_end = strtotime("{$date}") + 86400; } else { $day_end = strtotime("{$date} {$period['end']}"); } } public function testZero() { $x = time(); $date = date('Y-m-d H:i:s',1619020800); $day_start = strtotime("{$date}"); } public function testDate() { $date = date('Y-m-d',time()); $day_start = strtotime("{$date}"); $begin = $day_start - 6 * 86400; } public function testFloat() { $t = intval("30.00" + 0.05); $x = 1.6; $y = 8; $t = $x == ($y - 6.4); $z = $y - 6.4; $ta = round($x,2) == round($y - 6.4,2); } public function testMd5() { $x = 'amount=100.00&cardno=1000113200030706234&mchid=10104&order_sn=200000001743&state=CANCEL&trade_no=970664650712097821&key=10086'; $y = md5($x); } public function testSuning() { $x = date("YmdHis",time()); } public function testSort() { //不过载的排在前面 $ascending = function ($l, $r) { return $l < $r ? -1 : 1; }; $usable_items = []; usort($usable_items, $ascending); } public function testChSort() { $data = ['黄刚','首浩话费','领袖科技','闪光点','金蝠国际','金灏便民','远行云商','迅银-加油','车猪猪','车卫士-话费3分钟','车卫士-话费10分钟','车卫士-24h慢充','车卫士','赤豹-6H慢充','裕寅旺-话费','裕寅旺-加油','葳崚科技','胡寿平','翼连','童维森-话费','秋成','甄祺-普充','甄祺-快充','琳珠-快充','琳珠','海南劲峰','海南公象','测试账户','泽恒加油','泽恒','河马代缴','沃斯达','比特烽-话费','武汉创悦慢充','武汉中瑞','武安创悦','橘米科技','橘米','椰子测试','椰子','森克','果子pay','木涛','有甯高价10分钟','有甯三网快充','有甯-24h慢充','有寗-加油','有寗-3分钟','有寗-10分钟','星凯信息2','星凯信息','星之予-话费','星之予','易派','易商惠众','易加互动','昊泽通信','昊泽慢充','旭友-普充','旭友-快充','方诺-慢充','抱阳','恒易迅-话费','恒易迅-慢充24h','恒易迅','小口袋-2h','小口袋','妃霓墨蜀','奇小宝','天采科技优质普充','天采科技','天采快充','国瑞-加油','和辉-普充','和辉-慢充','和辉-加油','吉瑞话费','华彬-话费','劲峰钱包-24h','劲峰钱包','劲峰混充','劲峰加油','劲峰三网快充','创悦慢充','创哈-加油','元培-24h慢充','停划算','亿畅通','享省科技','云洋','乐优-话费','中房','中乐-话费3分钟','中乐-话费24h','中乐-话费10分钟','中乐-快充','中乐','东典-话费','东东网-慢充24h','东东网','万图拍','一号话费','yezi01']; $x = []; foreach ($data as $item) { $x[] = ['p' => Pinyin::getPinyin($item), 'o' => $item]; } $asc = function ($l,$r) { $lp = $l['p']; $rp = $r['p']; $lo = $l['o']; $ro = $r['o']; if($lp == $rp) { return 0; } else { return strcmp($lp,$rp); } }; usort($x,$asc); $y = $data; } public function testMtrand() { for ($i = 0; $i < 10000; $i++) { $val = mt_rand(1,200); Log::record("{$val}",Log::DEBUG); } } public function testIsDay() { $ret = refill\functional::isDay(); } public function testFormat() { $x = date("Y-m-d H:i:s"); } }