0
您好我有一個從哪裏PHP的strtotime上週每天
`timestamp` >= '".$monS."' AND `timestamp` < '".$sunE."'
這裏是如何$monS
和$sunE
定義數據庫中選擇一個查詢:
$startTime = "00:00:00";
$endTime = "23:59:59";
$today = date('l', strtotime("now"));
if($today == "Monday"){
$monS = strtotime("yesterday -7 days $startTime");
$sunE = strtotime("yesterday -1 days $endTime");
}
if($today == "Tuesday"){
$monS = strtotime("yesterday -8 days $startTime");
$sunE = strtotime("yesterday -2 days $endTime");
}
if($today == "Wednesday"){
$monS = strtotime("yesterday -9 days $startTime");
$sunE = strtotime("yesterday -3 days $endTime");
}
if($today == "Thursday"){
$monS = strtotime("yesterday -10 days $startTime");
$sunE = strtotime("yesterday -4 days $endTime");
}
if($today == "Friday"){
$monS = strtotime("yesterday -11 days $startTime");
$sunE = strtotime("yesterday -5 days $endTime");
}
if($today == "Saturday"){
$monS = strtotime("yesterday -12 days $startTime");
$sunE = strtotime("yesterday -6 days $endTime");
}
if($today == "Sunday"){
$monS = strtotime("yesterday -13 days $startTime");
$sunE = strtotime("yesterday -7 days $endTime");
}
它的工作原理然而,大多數情況下,我認爲週末的行數可能不正確。我的網站上的工作人員表示,它並不包括週六和週日。我的腳本看起來好嗎?
'$ sun'的意思是'$ sunE'嗎? – Jayden 2014-10-08 20:04:47