-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