Object->run("Win">
时间:2021-07-01 10:21:17 帮助过:4人阅读
class rar
{
public $Path; //文件路径
public $Save; //保存路径
public $Object; //Wscript.Shell对象实例
function rar(){ //构造函数
$this->Object = new com("Wscript.Shell"); //实例化一个Shell对象
}
function Release(){ //解压方法
$this->Object->run("WinRAR x $this->Path $this->Save",1,false); //Path要解压的文件名及路径 Save保存路径
if($this->Object == true){
return true;
}else{
return false;
}
}
function Pressure(){ //压缩方法
$this->Object->run("WinRAR a $this->Save $this->Path",1,true); //Save压缩后保存的路径及文件名 Path要压缩的路径
if($this->Object == true){
return true;
}else{
return false;
}
}
}
$rar=new rar();
$rar->Path="F:/js/test/z.rar";
$rar->Save="F:/js/test";
if($rar->Release()){
die('解压成功');
}else{
die('解压失败');
}
?>