这是我到目前为止的情况。
function zip_gallery()
{
global $post;
$images = get_children(array(\'post_parent\' => get_the_ID(), \'post_type\' => \'attachment\', \'numberposts\' => -1, \'post_status\' => null, \'post_mime_type\' => \'image\', ));
if ($images) {
$save = $post->post_title;
$zip = new ZipArchive;
if ($zip->open($save . \'.zip\', ZIPARCHIVE::CREATE) === true) {
foreach ($images as $image) {
$file = wp_get_attachment_url($image->ID, \'full\', false, false);
$filename = pathinfo($file);
$zip->addFile($file, $filename);
}
$zip->close();
}
}
}
有人能解释一下我做错了什么吗。