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

search for in the

PharData::buildFromDirectory> <PharData::addFile
Last updated: Fri, 10 Oct 2008

view this page in

PharData::addFromString

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

PharData::addFromStringファイルシステム上のファイルを tar/zip アーカイブに追加する

説明

bool PharData::addFromString ( string $localname , string $contents )

このメソッドを使用すると、任意の文字列を tar/zip アーカイブに追加することができます。 アーカイブ内のファイル名は localname で指定したものとなります。 このメソッドは ZipArchive::addFromString() と同じようなものです。

パラメータ

localname

ファイルをアーカイブ内に格納するときのパス。

contents

ファイルに保存する内容。

返り値

返り値はありません。失敗時には例外をスローします。

例1 PharData::addFromString() の例

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

    
$a->addFromString('path/to/file.txt''my simple file');
    
$b $a['path/to/file.txt']->getContent();

    
// 大きなファイル用にストリームハンドルから追加するには offsetSet() を使用します
    
$c fopen('/path/to/hugefile.bin');
    
$a['largefile.bin'] = $c;
    
fclose($c);
} catch (
Exception $e) {
    
// ここでエラー処理をします
}
?>



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

PharData::buildFromDirectory> <PharData::addFile
Last updated: Fri, 10 Oct 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites