php èªå¨è®¡ç®12çè
<?生肖地方门户源码分享php
////-->åºçå¹´æ
/
*计ç®ä¸ªæ座
计ç®ä¸ªçè
计ç®å¹´é¾
*/
class timeage
{
public $y = 0;
public $m = 0;
public $d = 0;
public $age = 0;
public $time = 0;
public function __construct($time)
{
$this->time = $time;
$this->y = date('Y',$this->time);
$this->m = date('m',$this->time);
$this->d = date('d',$this->time);
}
public function getage()
{
$this->age = time() - $this->time;
$this->age = $this->age////;
return (int)$this->age;
}
public function getconstellation()
{
switch ($this->m)
{
case 1:
if ($this->d < )
{
$this->constellation = 'æ©ç¾¯åº§';
return $this->constellation;
}
else
{
$this->constellation = 'æ°´ç¶åº§';
return $this->constellation;
}
break;
case 2:
if ($this->d < )
{
$this->constellation = 'æ°´ç¶åº§';
return $this->constellation;
}
else
{
$this->constellation = 'å鱼座';
return $this->constellation;
}
break;
case 3:
if ($this->d < )
{
$this->constellation = 'å鱼座';
return $this->constellation;
}
else
{
$this->constellation = 'ç½ç¾åº§';
return $this->constellation;
}
break;
case 4:
if ($this->d < )
{
$this->constellation = 'ç½ç¾åº§';
return $this->constellation;
}
else
{
$this->constellation = 'éç座';
return $this->constellation;
}
break;
case 5:
if ($this->d < )
{
$this->constellation = 'éç座';
return $this->constellation;
}
else
{
$this->constellation = 'åå座';
return $this->constellation;
}
break;
case 6:
if ($this->d < )
{
$this->constellation = 'åå座';
return $this->constellation;
}
else
{
$this->constellation = 'å·¨è¹åº§';
return $this->constellation;
}
break;
case 7:
if ($this->d < )
{
$this->constellation = 'å·¨è¹åº§';
return $this->constellation;
}
else
{
$this->constellation = 'ç®å座';
return $this->constellation;
}
break;
case 8:
if ($this->d < )
{
$this->constellation = 'ç®å座';
return $this->constellation;
}
else
{
$this->constellation = 'å¤å¥³åº§';
return $this->constellation;
}
break;
case 9:
if ($this->d < )
{
$this->constellation = 'å¤å¥³åº§';
return $this->constellation;
}
else
{
$this->constellation = '天秤座';
return $this->constellation;
}
break;
case :
if ($this->d < )
{
$this->constellation = '天秤座';
return $this->constellation;
}
else
{
$this->constellation = '天è座';
return $this->constellation;
}
break;
case :
if ($this->d < )
{
$this->constellation = '天è座';
return $this->constellation;
}
else
{
$this->constellation = 'å°æ座';
return $this->constellation;
}
break;
case :
if ($this->d < )
{
$this->constellation = 'å°æ座';
return $this->constellation;
}
else
{
$this->constellation = 'æ©ç¾¯åº§';
return $this->constellation;
}
break;
}
}
public function getzodiac()
{
$this->animals = array('é¼ ', 'ç', 'è', 'å ', 'é¾', 'è','马', 'ç¾', 'ç´', '鸡', 'ç', 'çª');
$this->zodiac = ($this->y - ) % ;
return $this->animals[$this->zodiac];
}
}
$age = strtotime('--');
echo $age;
$a = new timeage($age);
echo '<br>';
echo $a->y;
echo '<br>';
echo $a->m;
echo '<br>';
echo $a->d;
echo '<br>';
echo $a->time;
echo '<br>';
echo $a->age;
echo '<br>';
echo $a->getage();
echo '<br>';
echo $a->getconstellation();
echo '<br>';
echo $a->getzodiac();
//没äºå¹²æ¿ä½ åäºä¸ªå ¨é¨çåè½å½æ° å代ç ç±» è®°å¾ç»å¥½è¯
2024-11-30 12:56
2024-11-30 12:37
2024-11-30 12:16
2024-11-30 11:55
2024-11-30 11:36