function jhc_get_keyid($tbname,$limit=10){
global $empire,$dbtbpre;
$maxid=$empire->gettotal("select max(id) as total from {$dbtbpre}ecms_{$tbname} ");
$ids=array();
$i=0;
while($i<$limit){
$key=rand(1,$maxid);
$key=$empire->gettotal("select id as total from {$dbtbpre}ecms_{$tbname} where id<=$key order by id desc limit 1 ");
if(in_array($key,$ids))continue;
$ids[]=$key;
$i++;
}
$rand=implode(',',$ids);
return $rand;
}
很赞哦 ()