Re: [請益] 請教一個日期條件設計問題

作者: gpmm (銀色)   2018-01-24 22:52:23
到底為什麼不直接用月判斷? XD
$currentMonth = date ('n') // Numeric representation of a month
$birthdayTime = strtotime ($birthday);
$birthdayMonth = date ('n', $bitrhdayTime);
if ($currentMonth == $birthdayMonth // 現在是生日月
|| ($currentMonth % 12 + 1) == $birthdayMonth) { // 或下個月是生日月
// 顯示相關資訊
}
另外你說的「在點選時,直接呼叫資料庫中的紀錄顯示,我要的資料」
這我看不太懂,不是就下 SQL 拿東西嗎?

Links booklink

Contact Us: admin [ a t ] ucptt.com