/**
* 秒转换为天,小时,分钟
*
* @return string
*/
function secondChanage()
{
$second= 10;//需要转换的时间.秒为单位
$newtime= '';
$d= floor($second/ (3600*24));
$h= floor(($second% (3600*24))/ 3600);
$m= floor((($second% (3600*24))% 3600)/ 60);
$s= $second- ($d*24*3600)- ($h*3600)- ($m*60);
empty($d)?
$newtime= (
empty($h)? (
empty($m)? $s. '秒' : (
empty($s)? $m.'分' : $m.'分'.$s.'秒'
)
): (
empty($m)&& empty($s)? $h. '时' : (
empty($m)? $h. '时' . $s. '秒' : (
empty($s)? $h. '时' . $m. '分' : $h. '时' . $m. '分' . $s. '秒'
)
)
)
): $newtime= (
empty($h)&& empty($m)&& empty($s)? $d. '天' : (
empty($h)&& empty($m)? $d. '天' . $s.'秒' : (
empty($h)&& empty($s)? $d. '天' . $m.'分' : (
empty($m)&& empty($s)? $d. '天' .$h. '时' : (
empty($h)? $d. '天' .$m. '分' . $s.'秒' : (
empty($m)? $d. '天' .$h. '时' . $s.'秒' : (
empty($s)? $d. '天' .$h. '时' . $m.'分' : $d. '天' .$h. '时' . $m.'分' . $s. '秒'
)
)
)
)
)
)
);
return $newtime;
}