php://memory and php://temp

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
per the documentation:  php://memory and php://temp are both listed
under "Allows Appending"

what am I missing / what's the point?

They only seem to work with read/write modes such as

closing the handle, or trying to open another handle without closing
the first essentially erase the contents... so what's the point of
fopen('php://memory','a') ?
a) be appending nothing,
b) no way to read what you just wrote?

sure would be nice if you could

$fh = fopen('php://memory', 'w');
fwrite($fh, 'test string');

$fh = fopen('php://memory', 'r');
$result = fgets($fh,2048);
echo $result;

Re: php://memory and php://temp

On 10/12/2010 9:44 PM, BKDotCom wrote:
Quoted text here. Click to load it

These are temporary "files" - as soon as they are closed, they go away,
as you note.  So it really doesn't make any sense to open them other
than for read/write.

Other options are there - but those are just standard options for any
file.  It doesn't mean you need to use them.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline