$dir  = './temp';
$desc = 'sdf.tar.gz';
system("tar czvf $desc $dir"); //压缩
system("tar zxvf $desc");      //解压不知是不是符合你的意思。