二维数组for foreach循环分页代码:
$temparr = array_slice($folder_list, ($page-1)*$imgnums, $imgnums);
//print_r($temparr);
foreach ($temparr as $kkk=>$vvv){
    //if($kkk=$imgnums*($page-1))
    if($vvv['type']=='folder'){
        //echo mb_convert_encoding ($file,'UTF-8','GBK');windows:  echo utf8_encode($file);Linux:
        echo '<a href="?f='.$vvv['name'].'">文件夹:'.$vvv['only_name'].'</a><br>';
    }else{
        echo iconv('gb2312','utf-8',$vvv['only_name']).'<br>';
    }
}

for循环分页


for($j=$imgnums*($page-1); $j<($imgnums*($page-1)+$imgnums)&&$j<$allnum; ++$j){
   if($folder_list[$j]['type']=='folder'){
        //echo mb_convert_encoding ($file,'UTF-8','GBK');windows:  echo utf8_encode($file);Linux:
        echo '<a href="?f='.$folder_list[$j]['name'].'">文件夹:'.$folder_list[$j]['only_name'].'</a><br>';
    }else{
        echo $folder_list[$j]['only_name'].'<br>';
    }
}

二维数组for foreach循环分页代码


发表评论 已发布 0

还可以输入 800 个字
 
 
打印