0
このコードはファイルを解凍して動作しています。 unzipした後、unzipフォルダ名の名前を取得する方法。 zipファイル名のように 'demo65856.zip'であり、解凍フォルダ名は 'demo'です。 ZIPARCHIVEを使用して手動から おかげ解凍後にフォルダ名の名前を取得
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.';
}
}
コードを自分のコードに実装できますか? – fiyan