网站目录压缩包解压文件代码

chenyajun  2022-10-16 15:33:47  阅读 1265 次 评论 0 条

把压缩包555.zip和unzip.php放在同一个目录,然后浏览器打开unzip.php即可解压

比如http://www.**.com/unzip.php

压缩包是什么名字就修改下面代码里面的两处555.zip即可

unzip.php文件代码

<?php$file = '555.zip';if (!is_file($file)) {
	exit('The file "555.zip" should be located next to this file, but it is not.');}$zip = new ZipArchive;$res = $zip->open($file);if ($res === TRUE) {
  $rs = $zip->extractTo(getcwd());
	if ($rs) {
		@unlink($file);
		header('Location: ./');
	} else {
		echo 'This installer failed to extract the contents of the archive file "'.$file.'".<br>';
		echo $zip->getStatusString();
	}} else {
  echo 'This installer failed to open the file "'.$file.'".';}

unzip.zip

本文地址:http://chenyajun.net/index.php/post/113.html
版权声明:本文为原创文章,版权归 chenyajun 所有,欢迎分享本文,转载请保留出处!

评论已关闭!