note 103893 modified in phar.using.stream by danbrown
| From: | danbrown@php.net | Date: | Wed, 11 May 2011 15:50:49 +0000 |
| Subject: | note 103893 modified in phar.using.stream by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179638@lists.php.net to get a copy of this message | ||
Some Examples of how to use the stream wrapper would be really helpful.
My floundering attempts reveal only the following:
<?php
$p = new PharData(dirname(__FILE__).'/phartest.zip', 0,'phartest',Phar::ZIP) ;
$p->addFromString('testfile.txt',
'this is just some test text');
// This works
echo file_get_contents('phar://phartest.zip/testfile.txt');
//This Fails
file_put_contents('phar://phartest.zip/testfile.txt',
'Thist is text for testfile.txt');
$context = stream_context_create(
array('phar' =>array('compress' =>Phar::ZIP))
) ;
//This Fails
file_put_contents(
'phar://phartest.zip/testfile.txt',
'Thist is text for testfile.txt',0,$context);
// This works but only with 'r' readonly mode.
$f = fopen(
'phar://C:\\Inetpub\\wwwroot\\PACT\\test\\phartest.zip\\testfile.txt',
'r') ;
?>
--was--
Some Examples of how to use the stream wrapper would be really helpful.
My floundering attempts reveal only the following:
$p = new PharData(dirname(__FILE__).'/phartest.zip', 0,'phartest',Phar::ZIP) ;
$p->addFromString('testfile.txt',
'this is just some test text');
// This works
echo file_get_contents('phar://phartest.zip/testfile.txt');
//This Fails
file_put_contents('phar://phartest.zip/testfile.txt',
'Thist is text for testfile.txt');
$context = stream_context_create(
array('phar' =>array('compress' =>Phar::ZIP))
) ;
//This Fails
file_put_contents(
'phar://phartest.zip/testfile.txt',
'Thist is text for testfile.txt',0,$context);
// This works but only with 'r' readonly mode.
$f = fopen(
'phar://C:\\Inetpub\\wwwroot\\PACT\\test\\phartest.zip\\testfile.txt',
'r') ;
http://php.net/manual/en/phar.using.stream.php