我将用户的生日存储在 birthday
中,为 1999-02-26。
如何判断生日是不是今天?
if(date('m-d') == ..?
最佳答案
这个答案应该有效,但它取决于 strtotime
能够弄清楚数据库的日期格式:
$birthDate = '1999-02-26'; // Read this from the DB instead
$time = strtotime($birthDate);
if(date('m-d') == date('m-d', $time)) {
// They're the same!
}
关于PHP:生日检查今天的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3873649/