错误:
警告:date()期望参数2为长
这是一个回发的PHP脚本部分,
$conv_time = time();
$click_time_to_date = new DateTime(date('Y-m-d h:i:s', $mysql['click_time']));
$conv_time_to_date = new DateTime(date('Y-m-d h:i:s', $conv_time));
$diff = $click_time_to_date->diff($conv_time_to_date);
$mysql['time_difference'] = $db->real_escape_string($diff->d.' days, '.$diff->h.' hours, '.$diff->i.' min and '.$diff->s.' sec');
$mysql['conv_time'] = $db->real_escape_string($conv_time);
$mysql['ip'] = $db->real_escape_string($_SERVER['HTTP_X_FORWARDED_FOR']);
$mysql['user_agent'] = $db->real_escape_string($_SERVER['HTTP_USER_AGENT']);
答案 0 :(得分:0)
您的click_time
字段可能属于DATETIME
,date()
期望第二个参数为时间戳(long
)。
尝试用以下代码替换第2行:
$click_time_to_date = new DateTime($mysql['click_time']);
或确保您的click_time
字段属于TIMESTAMP
类型。