根据我在手册中阅读的内容,我无法理解为什么我的代码会返回 if 语句的 else 部分。如果date('D')返回Tue为什么不运行 if 部分?
<?php
date_default_timezone_set('UTC');
$weekdays = array("Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun");
$today = date('D');
if(in_array("Mon", "Tue", "Wed", "Thur", "Fri", $weekdays) == $today)
{
echo "It's" . " ";
echo $today;
echo " " . "Get out of bed and go to work";
}else{
echo "Do whatever you want becuase it's" . " ";
echo $today;
};
?>
我尝试了各种方法并将if部分更改为此,但无济于事。
if(in_array(array("Mon", "Tue", "Wed", "Thur", "Fri"), $weekdays) == $today)
有人能告诉我语法有什么问题吗?