Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> PHP

Hàm zip_entry_open() trong PHP

Mô tả

Hàm zip_entry_open() mở một entry trong ZIP archive để đọc.

Cú pháp

zip_entry_open(zip_file, zip_entry, mode)

Tham số

  • zip_file − Resource file ZIP.

  • zip_entry − Resource entry ZIP.

  • mode − Chế độ truy cập (ví dụ: "rb").

Giá trị trả về

Trả về TRUE nếu thành công, FALSE nếu thất bại.

Ví dụ

<?php
$zip_file = zip_open("new.zip");
$zip_entry = zip_read($zip_file);
zip_entry_open($zip_file, $zip_entry, "rb");
$myfile = zip_entry_name($zip_entry);
if ($myfile == true)
    echo("Zip file: " . $myfile . " is opened now!<br>");
$flag = zip_entry_close($zip_entry);
if ($flag == true)
    echo($myfile . " closed!");
zip_close($zip_file);
?>

Kết quả

new/one is opened now!
new/one closed!