【发布时间】:2017-12-13 01:50:35
【问题描述】:
这是我的代码解压缩文件,它正在工作。解压后如何获取解压文件夹名称。像 zip 文件名是“demo65856.zip”,解压缩文件夹名是“demo”。 谢谢
if(isset($_POST['submit'])){
WP_Filesystem();
$destination = wp_upload_dir();
$normal_path = $path_array;
$filename = $result->theme_file_name;
$link_filename = substr($filename, 0, -4);
$destination_path = $destination['basedir'].'/theme/';
$demo_link = $destination['baseurl'].'/theme/'.$link_filename;
$unzipfile = unzip_file( $destination_path.$filename, $destination_path);
if ( $unzipfile ) {
echo '<h3> <a href="'.$demo_link.'">demo link has created</a></h3>';
} else {
echo 'There was an error unzipping the file.';
}
}
【问题讨论】: