-5
我希望在我的网站上显示像问候。如何知道今天是31日12月
只有月份和日期是31 日月或1 ST
月if($today =='12-31' || $today =='01-01'){
echo 'Greetings.';
}
我希望在我的网站上显示像问候。如何知道今天是31日12月
只有月份和日期是31 日月或1 ST
月if($today =='12-31' || $today =='01-01'){
echo 'Greetings.';
}
就产生$今天格式你正在寻找起来以后,使用PHP的date$today = date('m-d');
产生在示例代码中显示的数字{月} - {天}
<?php
$today = date('m-d');
if($today =='12-31' || $today =='01-01'){
echo 'Greetings.';
}
echo $today;
$yearend_date = strtotime('31 Dec');
$yearEnd = date('Y-m-d', $yearend_date);
$YearStart = date('Y-m-d',strtotime('+1 day',$yearend_date));
$today = date('Y-m-d');
if($yearEnd==$today || $YearStart==$today){
echo "greetings";
}
你看过php'date()'函数吗? –
我知道,但如何将比较帮助请 – noob
日期显示像2016-12-30我只想要月和日期 – noob