Css.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Sports\Controller;
  3. use BaseController\Controller;
  4. use Biz\Match\GetmatchData;
  5. class Css extends Controller {
  6. public function index(){
  7. $data['s_time'] =$this->ts_time();
  8. $s = $_REQUEST['data'];
  9. $arr = [];
  10. if(strstr($s,',')){
  11. $arr1 = explode(",", $s);
  12. if(!empty($arr1)){
  13. foreach($arr1 as $k=>$v){
  14. $arr[]= (int)$v*100;
  15. }
  16. }
  17. }else{
  18. for($i=0;$i<=$s;$i++){
  19. $arr[] = $i+1;
  20. }
  21. }
  22. $data['num'] = count($arr);
  23. $data['e_time'] =$this->ts_time();
  24. Render($data, '1', lang('Tips','Sports')->get('success'));
  25. }
  26. /**
  27. * 年月日、时分秒 + 3位毫秒数
  28. * @param string $format
  29. * @param null $utimestamp
  30. * @return false|string
  31. */
  32. public function ts_time($format = 'Y-m-d H:i:s.u', $utimestamp = null) {
  33. if (is_null($utimestamp)){
  34. $utimestamp = microtime(true);
  35. }
  36. $timestamp = floor($utimestamp);
  37. $milliseconds = round(($utimestamp - $timestamp) * 1000);
  38. return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp);
  39. }
  40. }