PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

ZipArchive::setCompressionIndex - Set the compression method of an entry defined by its index | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

ZipArchive::setCompressionIndex

(PHP 7, PECL zip >= 1.13.0)

ZipArchive::setCompressionIndexSet the compression method of an entry defined by its index

説明

bool ZipArchive::setCompressionIndex ( int $index , int $comp_method [, int $comp_flags = 0 ] )

Set the compression method of an entry defined by its index.

パラメータ

index

Index of the entry.

comp_method

The compression method. Either ZipArchive::CM_DEFAULT, ZipArchive::CM_STORE or ZipArchive::CM_DEFLATE.

comp_flags

Compression flags. Currently unused.

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

例1 Add files with different compression methods to an archive

<?php
$zip 
= new ZipArchive;
$res $zip->open('test.zip'ZipArchive::CREATE);
if (
$res === TRUE) {
    
$zip->addFromString('foo''Some text');
    
$zip->addFromString('bar''Some other text');
    
$zip->setCompressionIndex(0ZipArchive::CM_STORE);
    
$zip->setCompressionIndex(1ZipArchive::CM_DEFLATE);
    
$zip->close();
    echo 
'ok';
} else {
    echo 
'failed';
}
?>

忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「ZipArchive::setCompressionIndex - Set the compression method of an entry defined by its index」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | ZipArchive::setCompressionIndex - Set the compression method of an entry defined by its index」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: