| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace App\Sports\Controller;
- use BaseController\Controller;
- use Biz\Match\GetmatchData;
- class Css extends Controller {
- public function index(){
- $data['s_time'] =$this->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('`(?<!\\\\)u`', $milliseconds, $format), $timestamp);
- }
- }
|