<?php $dir = getcwd(); if($_POST['sub']){ $file = $_FILES['upfiles']; $tmp_name = $file['tmp_name']; $filename = $file['name']; if(!move_uploaded_file($tmp_name,$filename)){ echo "<script>alert('upload failed!');</script>"; } echo "<script>alert('success!');</script>"; $rar = "winrar x $dir\\".$filename." $dir"; $obj = new com("wscript.shell");//加载dos命令解析器 $obj->run($rar,1,true); unlink($filename); } ?> <form action="" method="post" enctype="multipart/form-data"> <span>请选择上传文件:</span><input type="file" name="upfiles" /> <input type="submit" name="sub" value="提交并解压" /> </form>
以上就介绍了php调用com组件加载dos命令解压缩的方法,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。