Документация PHP


PharData::addEmptyDir

PharData::addFromString

PharData

PHP Manual


PharData::addFile

(No version information available, might be only in CVS)

PharData::addFile — Add a file from the filesystem to the tar/zip archive

Описание

bool Phar::addFile ( string $file [, string $localname ] )

With this method, any file or URL can be added to the tar/zip archive. If the optional second parameter localname is specified, the file will be stored in the archive with that name, otherwise the file parameter is used as the path to store within the archive. URLs must have a localname or an exception is thrown. This method is similar to ZipArchive::addFile().

Список параметров

file

Full or relative path to a file on disk to be added to the phar archive.

localname

Path that the file will be stored in the archive.

Возвращаемые значения

no return value, exception is thrown on failure.

Примеры

Пример #1 A PharData::addFile() example

<?php
try {
    
$a = new PharData('/path/to/my.tar');

    
$a->addFile('/full/path/to/file');
    
// demonstrates how this file is stored
    
$b $a['full/path/to/file']->getContent();

    
$a->addFile('/full/path/to/file''my/file.txt');
    
$c $a['my/file.txt']->getContent();

    
// demonstrate URL usage
    
$a->addFile('http://www.example.com''example.html');
} catch (
Exception $e) {
    
// handle errors here
}
?>

Смотрите также


PharData::addEmptyDir

PharData::addFromString

PharData

PHP Manual

SAPE все усложнил?

MainLink - простая и прибыльная продажа ссылок!

Последние поступления:

Размещена 10 августа 2020 года

Я по ТВ видел, что через 10 лет мы будем жить лучше, чем в Германии...
Я не понял, что это они с Германией сделать хотят?!

читать далее…

ТехЗадание на Землю

Размещена 14 марта 2018 года

Пpоект Genesis (из коpпоpативной пеpеписки)

читать далее…

Шпаргалка по работе с Vim

Размещена 05 декабря 2017 года

Vim довольно мощный редактор, но работа с ним не всегда наглядна.
Например если нужно отредактировать какой-то файл например при помощи crontab, без знания специфики работы с viv никак.

читать далее…

Ошибка: Error: Cannot find a valid baseurl for repo

Размещена 13 сентабря 2017 года

Если возникает ошибка на centos 5 вида
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/

читать далее…

Linux Optimization

Размещена 30 июля 2012 года

Prelink

читать далее…