ユーザーが最後にシステムにログインしてから何日経過したかを確認しようとしています。彼が最後にmysqlテーブルの列(日時)から入力した時刻を取得します。だから私は書いた:
$user_last_visit = $user_info['last_updated']; // 2013-08-08 00:00:00
$user_last_visit_str = strtotime($user_last_visit); // 1375912800
$today = strtotime(date('j-m-y')); // 1250114400
$diff = $today - $user_last_visit_str;
$user_info['last_updated']
2013-08-08 00:00:00 の値で最後に訪れたのはどこですか。- strtotime の後
$user_last_visit_str
、1375912800 に等しくなります $today
9-08-13 の値を持ち、strtotime の後に 1250114400 を取得します。
(1 日 =ミリ秒)で正の値を取得する代わりに、何らかの理由$diff = $today - $user_last_visit_str;
で負の値が得られます。24*60*60*1000
24*60*60*1000
何か案は?