<? //打开目录 $id=opendir("./007"); $js=0; while ($lb=readdir($id)) { $lFiles[$js]=$lb; $js++; } //显示文件列表 for ($i=0;$i<=$js;$i++) {header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=$lFiles[$i]");echo $lFiles[$i]; } closedir($id); ?> 是这样加的吗? 这样就报错提示如下: .<br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>14</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>15</b><br /> ..<br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>14</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>15</b><br /> 常州软件园招商引资计划2.doc<br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>14</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>15</b><br /> 请帮看看,错在哪里,怎么改!
header("Content-Disposition: attachment; filename=待保存的文件名";
输出文件内容
//打开目录
$id=opendir("./007");
$js=0;
while ($lb=readdir($id))
{
$lFiles[$js]=$lb;
$js++;
}
//显示文件列表
for ($i=0;$i<=$js;$i++)
{header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$lFiles[$i]");echo $lFiles[$i];
}
closedir($id);
?>
是这样加的吗?
这样就报错提示如下:
.<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>14</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>15</b><br />
..<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>14</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>15</b><br />
常州软件园招商引资计划2.doc<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>14</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at e:\php\sunel\system-fileslist.php:17) in <b>e:\php\sunel\system-fileslist.php</b> on line <b>15</b><br />
请帮看看,错在哪里,怎么改!
我有一个文件夹,
1、我想把它里面的内容列出来
2、点击列出的文件就可以将该文件保存下来!文件夹路径"./007"