Heim > Artikel > Backend-Entwicklung > 函数代码求解
function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = FALSE, $simple = FALSE, $jsfunc = FALSE)
{
return $num > $perpage ? helper_page::multi($num, $perpage, $curpage, $mpurl, $maxpages, $page, $autogoto, $simple, $jsfunc) : '';
}
请高手详细解释上段函数代码的意义,谢谢!
没有上下文,无法解释
函数相关上下文:
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$page=$_GET['page']?$_GET['page']:0;
$perpage = 30;
$start = ($page-1)*$perpage;
$statusarr=array(0=>'审核中',1=>'拍卖中',2=>'已结束');
$mpurl= 'home.php?mod=auction&ac=auctions';
$perpages = array($perpage => ' selected');
$bidauc=C::t('auction_bidden')->fetch_distinct_atnid('uid='.$_G['uid'],'ORDER BY inputtime desc',$start,$perpage);
foreach($bidauc AS $key=>$value)
{
$warr[]=$value['atnid'];
}
$aucclouse=implode(',',$warr);
//die($aucclouse."aaa");
$auclist=C::t('auction_inauctions')->fetch_all_by_sql('id in('.$aucclouse.')');
$count=C::t('auction_bidden')->fetch_distinct_atnid('uid='.$_G['uid'],'','','',1);
$multipage = multi($count, $perpage, $page, $mpurl);
include template('home/auction_bidauctions');
discuz分页函数的multi的使用
在function_core文件中的multi函数是分页函数,原型如下:
multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = FALSE, $simple = FALSE)
其中
$num 总记录数,
$perpage 每页显示记录数,
$curpage 当前页码数,
$mpurl 页面的URL,如果url中存在"?"的,后面加上“&page=3”(3是页码数),不存在“?”的后面加上"?page=4"(4是页码数),
$maxpages = 0 位置叁数,
$page = 10 每次显示几个页面。
其他的叁数可以不填。