ts_time(); $s = $_REQUEST['data']; $arr = []; if(strstr($s,',')){ $arr1 = explode(",", $s); if(!empty($arr1)){ foreach($arr1 as $k=>$v){ $arr[]= (int)$v*100; } } }else{ for($i=0;$i<=$s;$i++){ $arr[] = $i+1; } } $data['num'] = count($arr); $data['e_time'] =$this->ts_time(); Render($data, '1', lang('Tips','Sports')->get('success')); } //获取毫秒级时间 public function getMsecToMescdate($msectime) { $msectime = $msectime * 0.001; if(strstr($msectime,'.')){ sprintf("%01.3f",$msectime); list($usec, $sec) = explode(".",$msectime); $sec = str_pad($sec,3,"0",STR_PAD_RIGHT); }else{ $usec = $msectime; $sec = "000"; } $date = date("Y-m-d H:i:s.x",$usec); $mescdate = str_replace('x', $sec, $date); return $mescdate; } /** * 年月日、时分秒 + 3位毫秒数 * @param string $format * @param null $utimestamp * @return false|string */ public function ts_time($format = 'Y-m-d H:i:s.u', $utimestamp = null) { if (is_null($utimestamp)){ $utimestamp = microtime(true); } $timestamp = floor($utimestamp); $milliseconds = round(($utimestamp - $timestamp) * 1000); return date(preg_replace('`(?