/*** 根据生日中的月份和日期来计算所属 星座** @param int $birth_month //9* @param int $birth_date //1** @return string*/public function get_constellation($birth_month, $birth_date) {//判断的时候,为避免出现1和true的疑惑,或是判断语句始终为真的问题,这里统一处理成字符串形式$birth_month = strval($birth_month);$constellation_name = array('水瓶座','双鱼座','白羊座','金牛座','双子座','巨蟹座','狮子座','处女座','天秤座','天蝎座','射手座','摩羯座');if ($birth_date <= 22) {if ('1' != $birth_month) {$constellation = $constellation_name[$birth_month - 2];} else {$constellation = $constellation_name[11];}} else {$constellation = $constellation_name[$birth_month - 1];}return $constellation;}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!