算法错了,比如$today=20061121,$thattime=2006-10-11
$today - $thattime = 20061121 - 20061011 = 110
显然,20061011并不是110天前.楼主加油,万事开头难.
$today - $thattime = 20061121 - 20061011 = 110
显然,20061011并不是110天前.楼主加油,万事开头难.
调试欢乐多
$today = $time;
$thattime = mktime(0,0,0,$b,$c,$a);
$hiday = ($today - $thattime) / 60 /60 /24;
$lastday = mktime (0,0,0,$b,$c,$a); $subday=round((time()-$lastday)/3600/24); echo " 吼吼,偶学习php ".$subday." 天了";
list($a,$b,$c) = explode('-',substr($thattime,0,10));
$thatday = $a.$b.$c;其次, elseif太多了,影响程序效率.
建议使用switch($hiday){}
btw:
list($a,$b,$c) = explode('-',substr($thattime,0,10));
$thatday = $a.$b.$c;can change to:
$thatday = str_replace('-','',substr($thattime,0,10));