MySQL의 세션과 PHP 설정이 모두 같은 시간대를 공유하는, 당신은 영어로 적당한 시간 얻기 위해 이런 일을 사용할 수 있는지 가정 : 보지 않고
이
function toFriendlyTime($seconds) {
// Used in the item view, this function returns a 'friendly', rough-idea type time, like "3 hours" or "4 months"
$measures = array(
'month'=>30*24*60*60,
'week'=>7*24*60*60,
'day'=>24*60*60,
'hour'=>60*60,
'minute'=>60,
'second'=>1,
);
foreach ($measures as $label=>$amount) {
if ($seconds >= $amount) {
$howMany = floor($seconds/$amount);
return $howMany." ".$label.($howMany > 1 ? "s" : "");
}
}
return "1 second";
}
출처
2013-07-18 03:44:56
gbe
많이 말할 수 없다 당신의 왜냐하면 $ eventTime을 생성 한 서버가'time()'을 검사 한 서버로부터 1 시간 갭이 있기 때문입니다. – DevZer0
글쎄, 로컬 호스팅을 사용하고 있습니다. 나는 시간대 설정이나 얼간이가 어딘지 궁금한가요? –
어떻게'$ eventTime' 값을 만드나요? – DevZer0