php 月份查询生日_PHP----------php根据生日(时间戳)计算星座

/**

* 根据时间戳计算星座

* @param $time

* @return mixed

*/

function get_constellation($time)

{

$y   = date("Y").'-';

$his = ' 00:00:00';

$birth_month = date("m", $time);

$birth_date  = date("d", $time);

$userTime = strtotime($y.$birth_month.'-'.$birth_date.$his);

$januaryS   = strtotime($y.'01-20'.$his);

$januaryE   = strtotime($y.'02-18'.$his);

$februaryS  = strtotime($y.'02-19'.$his);

$februaryE  = strtotime($y.'03-20'.$his);

$marchS     = strtotime($y.'03-21'.$his);

$marchE     = strtotime($y.'04-19'.$his);

$aprilS     = strtotime($y.'04-20'.$his);

$aprilE     = strtotime($y.'05-20'.$his);

$mayS       = strtotime($y.'05-21'.$his);

$mayE       = strtotime($y.'06-21'.$his);

$juneS      = strtotime($y.'06-22'.$his);

$juneE      = strtotime($y.'07-22'.$his);

$julyS      = strtotime($y.'07-23'.$his);

$julyE      = strtotime($y.'08-22'.$his);

$augustS    = strtotime($y.'08-23'.$his);

$augustE    = strtotime($y.'09-22'.$his);

$septemberS = strtotime($y.'09-23'.$his);

$septemberE = strtotime($y.'10-23'.$his);

$octoberS   = strtotime($y.'10-24'.$his);

$octoberE   = strtotime($y.'11-22'.$his);

$novemberS  = strtotime($y.'11-23'.$his);

$novemberE  = strtotime($y.'12-21'.$his);

if($userTime >= $januaryS && $userTime <= $januaryE){

$constellation = '水瓶座';

}elseif($userTime >= $februaryS && $userTime <= $februaryE){

$constellation = '双鱼座';

}elseif($userTime >= $marchS && $userTime <= $marchE){

$constellation = '白羊座';

}elseif($userTime >= $aprilS && $userTime <= $aprilE){

$constellation = '金牛座';

}elseif($userTime >= $mayS && $userTime <= $mayE){

$constellation = '双子座';

}elseif($userTime >= $juneS && $userTime <= $juneE){

$constellation = '巨蟹座';

}elseif($userTime >= $julyS && $userTime <= $julyE){

$constellation = '狮子座';

}elseif($userTime >= $augustS && $userTime <= $augustE){

$constellation = '处女座';

}elseif($userTime >= $septemberS && $userTime <= $septemberE){

$constellation = '天秤座';

}elseif($userTime >= $octoberS && $userTime <= $octoberE){

$constellation = '天蝎座';

}elseif($userTime >= $novemberS && $userTime <= $novemberE){

$constellation = '射手座';

}else{

$constellation = '摩羯座';

}

return $constellation;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值