php 获取剩余时间, 日,时,分展示...
作者:互联网
private function left_time_str($sale_time){
$sale_time = strtotime($sale_time);
$left_time = $sale_time - time();
if($left_time <= 0){
return '已经开始';
}
$str = '距离开始还';
$day = floor($left_time/86400);
$hour = floor(($left_time - $day * 86400)/3600);
$min = floor((($left_time - $day * 86400) - $hour * 3600)/60);
if ($day > 0) $str .= $day . '天';
if ($hour > 0) $str .= $hour . '小时';
if ($min > 0) $str .= $min . '分钟';
return $str;
}
标签:剩余时间,...,hour,min,sale,str,time,php,left 来源: https://www.cnblogs.com/pansidong/p/12803975.html