//通过出生月日返回星座
function get_constellation($birthmonth,$birthday) {
$constellation=array('constellation_1' => '水瓶座',
'constellation_2' => '双鱼座',
'constellation_3' => '白羊座',
'constellation_4' => '金牛座',
'constellation_5' => '双子座',
'constellation_6' => '巨蟹座',
'constellation_7' => '狮子座',
'constellation_8' => '处女座',
'constellation_9' => '天秤座',
'constellation_10' => '天蝎座',
'constellation_11' => '射手座',
'constellation_12' => '摩羯座');
$birthmonth = intval($birthmonth);
$birthday = intval($birthday);
$idx = $birthmonth;
if ($birthday <= 22) {
if (1 == $birthmonth) {
$idx = 12;
} else {
$idx = $birthmonth - 1;
}
}
return $idx > 0 && $idx <= 12 ? $constellation['constellation_'.$idx] : '';
}
//通过出生年返回生肖
function get_zodiac($birthyear) {
$zodiac=array('zodiac_1' => '鼠',
'zodiac_2' => '牛',
'zodiac_3' => '虎',
'zodiac_4' => '兔',
'zodiac_5' => '龙',
'zodiac_6' => '蛇',
'zodiac_7' => '马',
'zodiac_8' => '羊',
'zodiac_9' => '猴',
'zodiac_10' => '鸡',
'zodiac_11' => '狗',
'zodiac_12' => '猪');
$birthyear = intval($birthyear);
$idx = (($birthyear - 1900) % 12) + 1;
return $idx > 0 && $idx <= 12 ?$zodiac['zodiac_'. $idx] : '';
}如果本文对你有帮助,欢迎打赏本站

支付宝扫码打赏
微信扫码打赏
