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

search for in the

ZipArchive::locateName> <ZipArchive::GetStatusString
[edit] Last updated: Fri, 24 Jun 2011

view this page in

ZipArchive::getStream

(PHP 5 >= 5.2.0, PECL zip >= 1.1.0)

ZipArchive::getStreamدریافت هندلر فایل به ورودی تعریف شده با نام (تنها خواندنی)

Description

resource ZipArchive::getStream ( string $name )

دریافت هندلر فایل ورودی تعریف شده با نام. در حال حاضر تنها عمل خواندن را پشتیبانی می‌کند.

Parameters

name

نام ورودی برای استفاده.

Return Values

بازکرداندن اشاره‌گر فایل (resource) در صورت موفقیت or FALSE on failure.

Examples

Example #1 دریافت محتوای ورودی با استفاده از fread() و ذخیره آن

<?php
$content 
'';
$z = new ZipArchive();
if (
$z->open('test.zip')) {
    
$fp $z->getStream('test');
    if(!
$fp) exit("failed\n");

    while (!
feof($fp)) {
        
$contents .= fread($fp2);
    }

    
fclose($fp);
    
file_put_contents('t',$contents);
    echo 
"done.\n";
}
?>

Example #2 مانند مثال قبلی اما با استفاده از fopen() و پوشش جریان zip

<?php
$fp 
fopen('zip://' dirname(__FILE__) . '/test.zip#test''r');
if (!
$fp) {
    exit(
"cannot open\n");
}
while (!
feof($fp)) {
    
$contents .= fread($fp2);
    echo 
"$contents\n";
}
fclose($fp);
echo 
"done.\n";
?>

Example #3 پوشش و تصویر جریات به همراه تابع xml نیز می‌توانند استفاده شوند

<?php
$im 
imagecreatefromgif('zip://' dirname(__FILE__) . '/test_im.zip#pear_item.gif');
imagepng($im'a.png');
?>


add a note add a note User Contributed Notes ZipArchive::getStream - [0 notes]
There are no user contributed notes for this page.

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