Action中dump()查询结果如下:
array(2) {
[0] => array(1) {
["create_time"] => string(19) "2012-09-17 11:49:35"
}
[2] => array(1) {
["create_time"] => string(19) "2012-09-17 11:49:35"
}
html中
<volist name='' id='date'>
当前时间-{$date.create_time}=相差的年数
</volist>
如果$str里的时间小于2014-8-13应该就是没有2年
可他算出来的是2年这不准确啊,没有把月份也拿去计算
$birth='2011-12-18';
list($by,$bm,$bd)=explode('-',$birth);
$cm=date('n');
$cd=date('j');
$age=date('Y')-$by-1;
if ($cm>$bm || $cm=$bm && $cd>=$bd) $age++;
echo "大小:$age";