PHP Класс Contao\ZipReader

Usage: $zip = new ZipReader('test.zip'); while ($zip->next()) { echo $zip->->file_name; }
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$arrFiles array File list
$arrHeader array Archive header
$resFile resource File handle
$strFile string File name

Открытые методы

Метод Описание
__construct ( string $strFile ) Open the archive and return the file handle
__destruct ( ) Close the file handle
__get ( string $strKey ) : mixed | null Return a property of the archive header or the current file
current ( ) : array Return the current file as array
first ( ) : ZipReader Go to the first file of the archive
getFile ( string $strName ) : boolean Set the internal pointer to a particular file
getFileList ( ) : array Return a list of all files in the archive
last ( ) : ZipReader Go to the last file of the archive
next ( ) : ZipReader | boolean Go to the next file of the archive
prev ( ) : ZipReader | boolean Go to the previous file of the archive
reset ( ) : ZipReader Reset the archive
unzip ( ) : string Unzip the current file and return its contents as string

Защищенные методы

Метод Описание
decToUnix ( integer $intTime, integer $intDate ) : integer Calculate the Unix timestamp from two hexadecimal values
readCentralDirectory ( ) : array Return a list of all files in the archive

Описание методов

__construct() публичный Метод

Open the archive and return the file handle
public __construct ( string $strFile )
$strFile string The file path

__destruct() публичный Метод

Close the file handle
public __destruct ( )

__get() публичный Метод

Return a property of the archive header or the current file
public __get ( string $strKey ) : mixed | null
$strKey string The property name
Результат mixed | null The property value or null

current() публичный Метод

Return the current file as array
public current ( ) : array
Результат array The current file array

decToUnix() защищенный Метод

Calculate the Unix timestamp from two hexadecimal values
protected decToUnix ( integer $intTime, integer $intDate ) : integer
$intTime integer The time integer
$intDate integer The date integer
Результат integer The Unix timestamp

first() публичный Метод

Go to the first file of the archive
public first ( ) : ZipReader
Результат ZipReader The object instance

getFile() публичный Метод

Set the internal pointer to a particular file
public getFile ( string $strName ) : boolean
$strName string The file name
Результат boolean True if the file was found

getFileList() публичный Метод

Return a list of all files in the archive
public getFileList ( ) : array
Результат array The files array

last() публичный Метод

Go to the last file of the archive
public last ( ) : ZipReader
Результат ZipReader The object instance

next() публичный Метод

Go to the next file of the archive
public next ( ) : ZipReader | boolean
Результат ZipReader | boolean The object instance or false if there is no next file

prev() публичный Метод

Go to the previous file of the archive
public prev ( ) : ZipReader | boolean
Результат ZipReader | boolean The object instance or false if there is no previous file

readCentralDirectory() защищенный Метод

Return a list of all files in the archive
protected readCentralDirectory ( ) : array
Результат array The files array

reset() публичный Метод

Reset the archive
public reset ( ) : ZipReader
Результат ZipReader The object instance

unzip() публичный Метод

Unzip the current file and return its contents as string
public unzip ( ) : string
Результат string The file content

Описание свойств

$arrFiles защищенное свойство

File list
protected array $arrFiles
Результат array

$arrHeader защищенное свойство

Archive header
protected array $arrHeader
Результат array

$resFile защищенное свойство

File handle
protected resource $resFile
Результат resource

$strFile защищенное свойство

File name
protected string $strFile
Результат string