请问谁有把ZIP文件分解并读出所有目录和各目录下文件名的程序??? 如果没有ZIP分解,只是取得所有目录和各目录下文件名的程序也可以,急切需要,谢谢了 [email protected] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 zip分解是什么意思?unzip?以下是我的程序,希望能帮到你//function startfunction handle($path) { $handle=opendir($path); readdir($handle); readdir($handle); while ($file = readdir($handle)) { echo "$file<p>"; if(strstr($file,".shtml")) { $filename="".$path."/".$file; $fd = fopen($filename, "r"); while (!feof($fd)) { $buffer = fgetss($fd,255); $body=$body.$buffer; } //$body中存的是所有目录中index.shtml的内容 fclose($fd); }else if(!strstr($file,".")) { $pathx=$path."/".$file; handle($pathx); }else echo "not"; } closedir($handle); }//function end 谢谢你的回复。但我的意思是想读出ZIP文件里面的内容,不知道PHP是否可以做到这样的功能?? 这里有个php manual中的例子(有英文的可以下的,www.php.net)php有zip支持库的,只读。<?php$zip = zip_open("/tmp/test2.zip");if ($zip) { while ($zip_entry = zip_read($zip)) { echo "Name: " . zip_entry_name($zip_entry) . "\n"; echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n"; echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "\n"; echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n"; if (zip_entry_open($zip, $zip_entry, "r")) { echo "File Contents:\n"; $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); echo "$buf\n"; zip_entry_close($zip_entry); } echo "\n"; } zip_close($zip);}?> php在交叉编译到MIPS平台,无法获取系统时间 PHP和JS的配合使用 请大家推荐一款“小而精”的blog系统,PHP+MYSQl的,谢谢 正则去除<a>标签的问题哦 关于一个写入文件的问题 帮我看一下这个mysql中的sql语句,不知道哪里出了问题就是执行不对 请问如何将数据库表格行进行拆分后获取数据? 小弟最近新搞了一个小门户网站,大家来交流一下吧,花了半年的时间 向多个表填入相同字段的记录求指导 有个php+mssql的拍卖网站项目,报价20000元高吗? include有关 这段话说明了什么?
//function start
function handle($path)
{
$handle=opendir($path);
readdir($handle);
readdir($handle);
while ($file = readdir($handle))
{
echo "$file<p>";
if(strstr($file,".shtml"))
{
$filename="".$path."/".$file;
$fd = fopen($filename, "r");
while (!feof($fd))
{
$buffer = fgetss($fd,255);
$body=$body.$buffer;
}
//$body中存的是所有目录中index.shtml的内容
fclose($fd);
}else if(!strstr($file,"."))
{
$pathx=$path."/".$file;
handle($pathx);
}else echo "not"; }
closedir($handle);
}//function end
php有zip支持库的,只读。
<?php
$zip = zip_open("/tmp/test2.zip");
if ($zip) {
while ($zip_entry = zip_read($zip)) {
echo "Name: " . zip_entry_name($zip_entry) . "\n";
echo "Actual Filesize: " . zip_entry_filesize($zip_entry) . "\n";
echo "Compressed Size: " . zip_entry_compressedsize($zip_entry) . "\n";
echo "Compression Method: " . zip_entry_compressionmethod($zip_entry) . "\n"; if (zip_entry_open($zip, $zip_entry, "r")) {
echo "File Contents:\n";
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
echo "$buf\n"; zip_entry_close($zip_entry);
}
echo "\n"; } zip_close($zip);}?>