System::mktemp
Synopsis
mixed System::mktemp (
string $args
= null
)
Description
Creates temporary files or directories. This function will remove the created files when the scripts finish its execution.
Parameter
-
string $args
- The arguments-
prefix
- The string that will be prepended to the temp name (defaults totmp
) -
-d
- A temporary dir will be created instead of a file. -
-t
- The target dir where the temporary file or directory will be created. If this parameter is missing, by default the environment varsTMP
on Windows orTMPDIR
on Unix will be used. If these vars are also missingc:\windows\temp
or/tmp
will be used.
-
Return value
mixed
-
the full path of the created file or dir, or FALSE
Note
This function can be called statically.
See
Example
Using mktemp()
<?php
$tempfile = System::mktemp("prefix");
$tempdir = System::mktemp("-d prefix");
$tempfile = System::mktemp();
$tempfile = System::mktemp("-t /var/tmp prefix");
?>