...帝國(guó)cms7.5怎樣實現(↔>♦xiàn)時(shí)間(jiān)為(wα₽èi):幾小(xiǎo)時(shí)前、幾天前等格式 帝國(g✘$↑uó)CMS調用(yòng)昨天更新的(de)文(×wén)章(zhāng) 将以下(xià)代碼放(fàng)到(d"αào):userfun.php
之間(jiān)
function user_time($tm,$num) {
₩₩©≤
if($num==1){
$tm = str♣♥ εtotime($tm);
}
$cur_tm = time();£✔ $dif = $cur_tm-$tm;
$•☆γpds = array('秒(miǎo)','分(fēn)鐘(zhōnπ←g)','小(xiǎo)時(shí)','天','周','個£≠"<(gè)月(yuè)','年(nián)')σ₽;
$lngh = array(1,60.3π→✘®600,86400,604800,2630880,31570560);
€₹≥©
for($v = sizeof($lnλ↕≈≥gh)-1; ($v >= 0)&&(($λ✔←no = $dif/$lngh[$v])<=1); $v--); σ©€if($v < 0) $v = 0; $_tm = $cur_tm-(§↑®Ω$dif%$lngh[$v]);
∞♠$no = floor($no);
$x☆✔ε₽=sprintf("%d%s",$no,$≤÷↕pds[$v]);
return $x."前"∏≤¥;
}
帝國(guó)cms最新版本 列表模闆調用(yòng):♦<'.user_time($r[newsti≈<me],0).' (注:如(rú)果不(bù)會(hu✘♦ì)列表放(fàng)代碼,請(qǐng)看(kàn←™∞ )wareelll 在11樓的(de)提示) 帝國(guó)cms模闆★®•網對(duì)《帝國(guó)cms7.2版本實現(xiàn)發布時$↑(shí)間(jiān)為(wèi):幾小(xiǎo)時(shí±∑™)前、幾天前等格式的(de)方法》總結來(lái)說(shuō),為(↑™wèi)我們企業(yè)網站(zhàn)建設很(hěn)實用( σ±Ωyòng)。
帝國(guó)cms7.5 所有(yǒu)官方₽ 插件(jiàn) 內(nèi)容模闆調用(yòng):
<?=user_time($bqr[♥€newstime],"Y-m-d")?>