我试图让脚本工作,检查$ acdate`是星期六还是星期天,如果是这样,它应该改变当前类与新的。但由于某种原因,我没有得到它的工作,并且我尝试了不同的方法,寻找可能的答案以使其起作用,但最终我不得不尝试你们,看看你是否有可能的解决方案来解决问题 caseclosure如果你想知道这个从0-9返回一个值,该行是我的代码检查一个变量是星期六还是星期日
<?php
$acdate = 0;
while ($row = mysql_fetch_assoc($tccrequest))
{
$acdate = date('d-m-Y',time() + 86400 * $row['autoclosure']);
if($row['ac update']!=1){
if ($acdate <= date('d-m-Y')){
$warning= "warning2";
}
else if ($acdate == date('d-m-Y')+1){
$warning= "nextday";
}
else if ($acdate == strtotime('this Saturday')){
$warning= "warning2";
}
else if ($acdate == strtotime('this Sunday')){
$warning= "warning2";
}
else{
$warning="";
$disable = "disabled=\"disabled\"";
}
}else{
$warning="updated";
//$disable = "disabled=\"disabled\"";
}
?>
如果$ acdate =星期六或星期天,是否没有办法检查日期函数?这是因为我使用$ acdate = date('d-m-Y',time()+ 86400 * $ row ['autoclosure']);写出今天日期+ $行['autoclosure']在一个领域,所以它看起来像10-08-2013我不需要使用strtotime,如果有一个很好的方法来获取date()来检查$ acdate是否星期六或星期天。 – Tman
@ user2955523:在这种情况下,使用不同的变量来存储时间戳。 –
我能用这个小代码解决它感谢所有的帮助。 \t \t \t否则,如果(日期( “W” 的strtotime( “$ acdate”))== 6日( “W” 的strtotime( “$ acdate”))== 0){ \t \t \t \t $ warning =“warning2”; \t \t \t} – Tman