$days = $days_of_week[2];
if (date('d/m/Y') == $days) {
$today = "Correct";
} else if (date('d/m/Y') != $days) {
$today = '<br>Non correct<br>';
$today1 = date('d/m/Y');
$today2 = $days_of_week[2];
}
当我回复$today
,$today1
和$today2
时会返回。
非正确06/11/2013 06/11/2013
我在这里遗漏了什么吗?试过===
答案 0 :(得分:1)
尝试将第一个字符串更改为
$days = trim($days_of_week[2]);
可能在您的输入中是任何“隐形”符号。例如任何空格
答案 1 :(得分:0)
试试这个:
$days = $days_of_week[2];
if (date('d/m/Y') == date('d/m/Y', strtotime($days))) {
$today = "Correct";
} else if (date('d/m/Y') != date('d/m/Y', strtotime($days))) {
$today = '<br>Non correct<br>';
$today1 = date('d/m/Y');
$today2 = $days_of_week[2];
}