PHP.mk документација

Phar::extractTo

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

phar.extractto.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека phar.extractto.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
Phar::extractTo

Референца за `phar.extractto.php` со подобрена типографија и навигација.

phar.extractto.php

Phar::extractTo

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)

Phar::extractToExtract the contents of a phar archive to a directory

= NULL

public Phar::extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool

Extract all files within a phar archive to disk. Extracted files and directories preserve permissions as stored in the archive. The optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The second parameter files can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method is similar to ZipArchive::extractTo().

Параметри

directory

Path to extract the given files to

files

The name of a file or directory to extract, or an array of files/directories to extract, null to skip this param

overwrite

Постави на true to enable overwriting existing files

Вратени вредности

returns true on success, but it is better to check for thrown exception, and assume success if none is thrown.

Errors/Exceptions

). Ако повикот не успее, ќе врати PharException if errors occur while flushing changes to disk.

Примери

ако е овозможен колекторот за отпадоци, Phar::extractTo() example

<?php
try {
$phar = new Phar('myphar.phar');
$phar->extractTo('/full/path'); // extract all files
$phar->extractTo('/another/path', 'file.txt'); // extract only file.txt
$phar->extractTo('/this/path',
array(
'file1.txt', 'file2.txt')); // extract 2 files only
$phar->extractTo('/third/path', null, true); // extract all files, and overwrite
} catch (Exception $e) {
// handle errors
}
?>

Белешки

Забелешка:

Windows NTFS датотечните системи не поддржуваат некои знаци во имињата на датотеките, имено <|>*?":. Имињата на датотеките со точка на крајот исто така не се поддржани. Спротивно на некои алатки за извлекување, овој метод не ги заменува овие знаци со подвлекување, туку наместо тоа не успева да ги извлече таквите датотеки.

Види Исто така

Белешки од корисници 1 белешка

msucco at mac dot com
пред 6 години
On the command line (*nix) you can use the following command to extract a phar file:

$ mkdir tmp && cd $_
$ phar extract -f ../file.phar
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.