在这个函数中数组$f里含有绝对路径的文件名、文件大小、访问时间、请问如何逐个取出$f数组中的值? function page($f,$pagesize,$current)
{
$_return = array();
$total = ceil(count($f)/$pagesize);
$prev = (($current-1)<=0 ? "1":($current-1));
$next =($current+1>=$total ? $total:$current+1);
$current =($current>($total) ? ($total):$current);
$start = ($current-1)*$pagesize;
if ($f!="." && $f!="..")
{
$t = array_map('filemtime',$f);
$s = array_map('filesize',$f);
array_multisort($t,SORT_DESC,$f);
}
for($i=$start;$i<($start+$pagesize);$i++)
{
array_push($_return,$f[$i]);
}
$pagearr["name"]=$_return;
$pagearr["page"]="<a href=\"?acticon=barfilelist&id=".$_GET['id']."&page=1\">first</a> <a href=\"?acticon=barfilelist&id=".$_GET['id']."&page={$prev}\">prev</a> <a href=\"?acticon=barfilelist&id=".$_GET['id']."&page={$next}\">next</a> <a href=\"?acticon=barfilelist&id=".$_GET['id']."&page={$total}\">end</a>";
return $pagearr;
}if ($handle = opendir($patch.$_GET['id']))
{
echo '<table id="tb1">
<th width="80px">客户编号</th>
<th width="200px">文件名</th>
<th width="80px">文件大小</th>
<th width="200px;">上传时间</th>
<th width="30px">下载</th>
</table>';
}
$f = array();
$f = glob($patch.$_GET['id'].'/*');
if (isset($_GET['page']))
{
$page = $_GET['page'];
}
else
{
$page = 1;
}
$r = page($f,10,$page);
foreach($r["name"] as $value){
echo $value.'
<br/>
';
}
echo $r["page"];
{
$_return = array();
$total = ceil(count($f)/$pagesize);
$prev = (($current-1)<=0 ? "1":($current-1));
$next =($current+1>=$total ? $total:$current+1);
$current =($current>($total) ? ($total):$current);
$start = ($current-1)*$pagesize;
if ($f!="." && $f!="..")
{
$t = array_map('filemtime',$f);
$s = array_map('filesize',$f);
array_multisort($t,SORT_DESC,$f);
}
for($i=$start;$i<($start+$pagesize);$i++)
{
array_push($_return,$f[$i]);
}
$pagearr["name"]=$_return;
$pagearr["page"]="<a href=\"?acticon=barfilelist&id=".$_GET['id']."&page=1\">first</a> <a href=\"?acticon=barfilelist&id=".$_GET['id']."&page={$prev}\">prev</a> <a href=\"?acticon=barfilelist&id=".$_GET['id']."&page={$next}\">next</a> <a href=\"?acticon=barfilelist&id=".$_GET['id']."&page={$total}\">end</a>";
return $pagearr;
}if ($handle = opendir($patch.$_GET['id']))
{
echo '<table id="tb1">
<th width="80px">客户编号</th>
<th width="200px">文件名</th>
<th width="80px">文件大小</th>
<th width="200px;">上传时间</th>
<th width="30px">下载</th>
</table>';
}
$f = array();
$f = glob($patch.$_GET['id'].'/*');
if (isset($_GET['page']))
{
$page = $_GET['page'];
}
else
{
$page = 1;
}
$r = page($f,10,$page);
foreach($r["name"] as $value){
echo $value.'
<br/>
';
}
echo $r["page"];
reset($arr);
while (list(, $value) = each($arr)) {
echo "Value: $value<br />\n";
}foreach ($arr as $value) {
echo "Value: $value<br />\n";
}