downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

PharData::convertToData> <PharData::compressFiles
[edit] Last updated: Fri, 25 May 2012

view this page in

PharData::__construct

(PHP >= 5.3.0, PECL phar >= 2.0.0)

PharData::__construct実行可能でない tar あるいは zip アーカイブオブジェクトを作成する

説明

PharData::__construct ( string $fname [, int $flags [, string $alias [, int $format = Phar::TAR ]]] )

パラメータ

fname

既存の tar/zip アーカイブあるいは作成したいアーカイブへのパス。

flags

親クラス PharRecursiveDirectoryIterator に渡すフラグ。

alias

この Phar アーカイブをストリーム機能からコールするときに使うエイリアス。

format

Phar クラスの ファイルフォーマット定数 のいずれか。

エラー / 例外

2 度コールされた場合に BadMethodCallException、 phar アーカイブのオープンに失敗した場合に UnexpectedValueException をスローします。

例1 PharData::__construct() の例

<?php
try {
    
$p = new PharData('/path/to/my.tar'CURRENT_AS_FILEINFO KEY_AS_FILENAME);
} catch (
UnexpectedValueException $e) {
    die(
'Could not open my.tar');
} catch (
BadMethodCallException $e) {
    echo 
'technically, this cannot happen';
}
echo 
file_get_contents('phar:///path/to/my.tar/example.txt');
?>



add a note add a note User Contributed Notes PharData::__construct
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites