destoon鑷?畾涔夊嚱鏁拌幏鍙栧垎绫诲悕绉帮紝鍦板尯鍚嶇О锛屽嚑澶╁墠鏃堕棿锛岃幏鍙栬瘎璁烘暟


来源: https://destoon.cc/ 时间: 2019-03-01 22:17:14 人气: 953 评论: 0

闇??鍦╝pi/extend.func.php 鏂囦欢涓?姞鍏ョ殑鍑芥暟


1銆佽幏鍙栧垎绫诲悕绉?cat_name($catid) 浼犲叆鍒嗙被id

function cat_name($catid) {
global $db;
$catid = intval($catid);
$catname = '';
    $r = $db->get_one("SELECt catname FROM {$db->pre}category WHERe catid=$catid");
    $catname = $r['catname'];
return $catname;
}


2銆佽幏鍙栧湴鍖哄悕绉?area_name($areaid) 浼犲叆鍦板尯id

function area_name($areaid) {
global $db;
$catid = intval($areaid);
$areaname = '';
    $r = $db->get_one("SELECt areaid,areaname FROM {$db->pre}area WHERe areaid=$areaid");
    $areaname = $r['areaname'];
return $areaname ? :'鍏ㄥ浗';
}


3銆佹椂闂存牸寮忓寲 姣斿?鍑犲ぉ鍓?gl_format_date($time)

//鏃堕棿鏍煎紡鍖?浼犲叆鏃堕棿鎴虫牸寮?464662723

function gl_format_date($time){
    $t=time()-$time;
    $f=array(
        '31536000'=>'骞?,
        '2592000'=>'涓?湀',
        '604800'=>'鏄熸湡',
        '86400'=>'澶?,
        '3600'=>'灏忔椂',
        '60'=>'鍒嗛挓',
        '1'=>'绉?
    );
    foreach ($f as $k=>$v)    {
        if (0 !=$c=floor($t/(int)$k)) {
            return $c.$v.'鍓?;
        }
    }
};

4銆?span style="color:#333333;font-family:Verdana, Arial;line-height:25.2px;background-color:#FFFFFF;">鑾峰彇璇勮?鏁?gl_get_comments($mid,$itemid)    

function gl_get_comments($mid,$itemid) {
global $db;
$nums = $db->get_one("SELECt COUNT(*) AS num FROM {$db->pre}comment WHERe item_mid='$mid' and item_id='$itemid'");
return $nums['num'] ;
}


destoon鑷?畾 浜屽紑鏁欑▼

评论
346655709