PHP Class Contao\ZipWriter

Usage: $zip = new ZipWriter('test.zip'); $zip->addFile('test.txt'); $zip->close();
Afficher le fichier Open project: contao/core-bundle Class Usage Examples

Protected Properties

Свойство Type Description
$intCount integer File count
$resFile resource File handle
$strCentralDir string Central directory
$strFile resource File name
$strTemp resource Temporary name

Méthodes publiques

Méthode Description
__construct ( string $strFile ) Create a new zip archive
__destruct ( ) Close the file handle if it has not been done yet
addFile ( string $strFile, string $strName = null ) Add a file to the archive
addString ( string $strData, string $strName, integer $intTime ) Add a file from a string to the archive
close ( ) Write the central directory and close the file handle

Méthodes protégées

Méthode Description
unixToHex ( integer $intTime ) : integer Convert a Unix timestamp to a hexadecimal value

Method Details

__construct() public méthode

Create a new zip archive
public __construct ( string $strFile )
$strFile string The file path

__destruct() public méthode

Close the file handle if it has not been done yet
public __destruct ( )

addFile() public méthode

Add a file to the archive
public addFile ( string $strFile, string $strName = null )
$strFile string The file path
$strName string An optional file name

addString() public méthode

Add a file from a string to the archive
public addString ( string $strData, string $strName, integer $intTime )
$strData string The data to be added
$strName string The file path
$intTime integer An optional modification timestamp

close() public méthode

Write the central directory and close the file handle
public close ( )

unixToHex() protected méthode

Convert a Unix timestamp to a hexadecimal value
protected unixToHex ( integer $intTime ) : integer
$intTime integer The Unix timestamp
Résultat integer The hexadecimal value

Property Details

$intCount protected_oe property

File count
protected int $intCount
Résultat integer

$resFile protected_oe property

File handle
protected resource $resFile
Résultat resource

$strCentralDir protected_oe property

Central directory
protected string $strCentralDir
Résultat string

$strFile protected_oe property

File name
protected resource $strFile
Résultat resource

$strTemp protected_oe property

Temporary name
protected resource $strTemp
Résultat resource