Re: Re: how do I use php://memory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Lee wrote:
> On Sat, Jan 30, 2010 at 9:00 AM, Shawn McKenzie <nospam@xxxxxxxxxxxxx>wrote:
> 
>> Mari Masuda wrote:
>>
>>> Has anyone ever successfully used php://memory before?  If so, what
>>> can I do to use it in my code?  Thank you.
>> No, but I was intrigued to try it, so I tested this:
>>
>> $text = 'Some text.';
>> file_put_contents('php://memory', $text);
>> echo file_get_contents('php://memory');
>>
>> And it returned nothing.  The docs suck on this and it apparently
>> doesn't work.  I see others use it with fopen(), but there is no mention
>> of which file functions it works with and which it doesn't.
>>
>>
> 
> Shawn
> 
> I did a sample test from the manual with fopen like this,
> 
> 
> <?php
> 
> $fp = fopen('php://memory', 'r+');
> 
> if ($fp)
> {
>     fputs($fp, "line 1\n");
> }
> 
> rewind($fp);
> echo stream_get_contents($fp);
> 
> ?>
> 
> console output
> 
> F:\wc\trunk>php -f m.php
> line 1
> 
> 
> 
> Regards,
> Eric,

So maybe it only works with an open file/stream resource? Hard to tell
with no docs.


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux