PHP ZIPARCHIVE 压缩文件处理目录结构 Prevent directory structure in compressed package

$flag = $zip->open($filePath, \ZIPARCHIVE::CREATE);
if ($flag!== TRUE) {
//if Linux,need check file authorization
exit("open file err="+$flag);
}
//add test.php to zip file
$zip->addFile('test.php');
// run rename
$zip->renameName('test.php','test.php');