Current Location: Home> Function Categories> tempnam

tempnam

Create a file with a unique file name
Name:tempnam
Category:File system
Programming Language:php
One-line Description:Create a unique temporary file.

Definition and usage

tempnam() function creates a temporary file with a unique file name.

If successful, the function returns the new temporary file name. If it fails, return false.

Example

 <?php
echo tempnam ( "C:\inetpub\testweb" , "TMP0" ) ;
?>

Output:

 C:\inetpub\testweb\TMP1.tmp

grammar

 tempnam ( dir , prefix )
parameter describe
dir Required. Specifies the directory where temporary files are created.
prefix Required. Specify the beginning of the file name.

illustrate

Create a file with a unique file name in the specified directory. If the directory does not exist, tempnam() will generate a file in the system temporary directory and return its file name.

Prior to PHP 4.0.6, the behavior of the tempnam() function depends on the system. In Windows, the TMP environment variable will pass the dir parameter, in Linux, the TMPDIR environment variable will take precedence, while in SVR4, the dir parameter is always used if the directory it points to exist.

Similar Functions
  • Get the last access time of the file fileatime

    fileatime

    Getthelastaccesstime
  • Change the current umask umask

    umask

    Changethecurrentumas
  • Positioning in file pointer fseek

    fseek

    Positioninginfilepoi
  • Lightweight consultation file locking flock

    flock

    Lightweightconsultat
  • Check if the file or directory exists file_exists

    file_exists

    Checkifthefileordire
  • Returns the file path information pathinfo

    pathinfo

    Returnsthefilepathin
  • Read a line from a file pointer fgets

    fgets

    Readalinefromafilepo
  • Format input from a file fscanf

    fscanf

    Formatinputfromafile
Popular Articles