★ wanayoo — archive 1999 http://uk.php.net/manual/sv/function.tmpfile.phpNouvelle recherche | Portail wanayoo
PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<tempnamtouch>
view the version of this page
Last updated: Thu, 24 Apr 2003

tmpfile

(PHP 3>= 3.0.13, PHP 4 )

tmpfile -- Creates a temporary file

Description

resource tmpfile ( void)

Creates a temporary file with an unique name in write mode, returning a file handle similar to the one returned by fopen(). The file is automatically removed when closed (using fclose()), or when the script ends.

For details, consult your system documentation on the tmpfile(3) function, as well as the stdio.h header file.

Exempel 1. tmpfile() example

$temp = tmpfile();
fwrite($temp, "writing to tempfile");
fclose($temp); // this removes the file

See also tempnam().



User Contributed Notes
tmpfile
add a note add a note
phpnovice at home-safe dot net
14-Apr-2003 11:28

First I wrote my script using the fancy proc_open() before I discovered my PHP was not at the necessary level.   Now I have to change it to use a temporary file for either the input or the output.  Then I started to write a version using tmpfile() only to discover it doesn't give me the file _name_ so that I can put that name in my command as the standard input redirect.  

For that purpose, if you don't have proc_open() available for bidirectional piping, it appears that tmpnam() is the right approach.

add a note add a note

<tempnamtouch>
 Last updated: Thu, 24 Apr 2003
show source | credits | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by: Kewlio.net Limited
Last updated: Sat Jun 7 04:10:06 2003 BST