请问下在接口里做个时间判断具体应该怎么写,如果现在是上午就输出上午的图片,如果是中午就输出中午的图片,如果是下午就输出下午的,如果是晚上就输出晚上的
// 判断当前时间段
if (hours >= 0 && hours <= 10) {
state = `../../static/img/zaoshang.gif`;
} else if (hours > 10 && hours <= 14) {
state= `../../static/img/zhongwu.gif`;
} else if (hours > 14 && hours <= 18) {
state= `../../static/img/xiawu.gif`;
} else if (hours > 18 && hours <= 24) {
state= `../../static/img/wanshang.gif`;
}
return state;
为什么返回的不是图片呀php实在不怎么会忘指教
<?php $houer = date("G"); $return =[]; $data = // 判断当前时间段 if ($hours >= 0 && $hours <= 10) { state = `../../static/img/zaoshang.gif`; } else if ($hours > 10 && $hours <= 14) { state= `../../static/img/zhongwu.gif`; } else if ($hours > 14 && $hours <= 18) { state= `../../static/img/xiawu.gif`; } else if ($hours > 18 && $hours <= 24) { state= `../../static/img/wanshang.gif`; }官方插件技术-周若尘
<?php $houer = date("G"); // 判断当前时间段 if ($hours >= 0 && $hours <= 10) { $return = `../../static/img/zaoshang.gif`; } else if ($hours > 10 && $hours <= 14) { $return= `../../static/img/zhongwu.gif`; } else if ($hours > 14 && $hours <= 18) { $return= `../../static/img/xiawu.gif`; } else if ($hours > 18 && $hours <= 24) { $return= `../../static/img/wanshang.gif`; }<?php $houer = date("G"); // 判断当前时间段 if ($hours >= 0 && $hours <= 10) { $return = "zaoshang"; } else if ($hours > 10 && $hours <= 14) { $return= "zhongwu"; } else if ($hours > 14 && $hours <= 18) { $return= "xiawu"; } else if ($hours > 18 && $hours <= 24) { $return= "wanshang"; }字母都写错了,你说你细不细心??