帝國(guó)cms7.5版本實現(xiàn)發布時(shí)間(jiān)為(w<♦←¥èi):幾小(xiǎo)時(shí)前、幾天前等格式的(de)方法,帝國 φ(guó)
來(lái)源:創立工(gōng)作(zuò)室 作(zuò)者:馮軍 發布時(shí)間(j♣€εiān):2020-07-25 10:41:01 閱讀(dú)™π≤↓ 1169 次
...帝國(guó)cms7.5怎樣實現(xiàn)時(shí)間(jiāΩ≠n)為(wèi):幾小(xiǎo)時(shí)前γλ¶、幾天前等格式 帝國(guó)CMS調用(yòng)昨天更→♦新的(de)文(wén)章(zhāng) 将以下(xià)代碼放≥α↑(fàng)到(dào):userfun.php
之間(jiān)
function user_time($tm,$n™γum) {
if($num==1){
φ • $tm = strtotime($tm);
}
$c"αur_tm = time(); $dif = $cur_tm-$tδ✔₩↓m;
$pds = array('秒(miǎo)','分(f∏←ēn)鐘(zhōng)','小(xiǎo)時(shí)','天','周'¥¥π,'個(gè)月(yuè)','年(nián)');
¶ > $lngh = array(1,60.3600,86400,604800,2630880,3•®1570560);
for($v = sizeof($lπ≥ngh)-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,$p>&βds[$v]);
return $x."前"↑×™;
}
帝國(guó)cms最新版本 列表模闆調用(yòng):'.user_time($r[newst←σ↕ime],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[new§α≈♣stime],"Y-m-d")?>
- 上(shàng)一(yī)篇:帝國(guó)cms靈動标簽調用(yòng)列表序列号
- 下(xià)一(yī)篇:帝國(guó)cms 靈動标簽調用(yòng)欄目×'✘名