我正在建立一个为客户预留的网站。保留的批次具有到期日期。在localhost中,一切正常。系统日期和时间是我的网站获得的。但是,当我在线测试它(我上传我的网站)时,它没有获得系统日期和时间。
$d = date('d M Y h:i A'); //TODAYS DATE---> this doesnt change when I change my PC's date and time
$curdate = strtotime($d)*1000;
echo $d;
$sql = "SELECT * FROM reservation";
$res = $conn->query($sql);
foreach ($res as $row) {
$exp = strtotime($row['expiration'])*1000;
$lot = $row['lot'];
$sqli = "SELECT * FROM reservation WHERE ".$curdate." >= ".$exp." AND status='reserved'";
$resu = $conn->query($sqli);
foreach ($resu as $ro) {
$id = $ro['reserve_id'];
$sl = "DELETE FROM reservation WHERE reserve_id='$id'";
$conn->query($sl);
$l = substr($ro['lot'], 1);
echo "<script>$(document).find('#_".$l."').css({'fill':'#848484'});</script>";
}
}
答案 0 :(得分:0)
PHP使用它在“服务器”上运行的机器的时间,仍然可以使用javascript / jquery -ajax调用从客户端机器获取时间,如:
var TimeNow = new Date();
$.ajax({
url : url,
data : {date : TimeNow}
});