Phpsys_get_temp_dir-return the temporary file path. Let's take a look at phpsys_get_temp_dir-how to use the function to return the temporary file path and how it works. Sys_get_temp_dir (5.2.1 in PHP5) has been paid. you need not to mention more. let's take a look at the usage and implementation principles of the function returned to the temporary file path in php sys_get_temp_dir.
Sys_get_temp_dir
("= 5.2.1" in PHP 5)
Let's take a look at the usage and implementation principles of the php sys_get_temp_dir-return temporary file path function.
Sys_get_temp_dir-the returned directory path is used for temporary files.
Description
String sys_get_temp_dir (invalid)
The PHP store temporary files in the returned directory path are used by default.
Return value
The temporary directory of the returned path.
Instance
Example #1 sys_get_temp_dir ()
Examples
Example #1 sys_get_temp_dir () example
// Create a temporary file in the temporary
// Files directory using sys_get_temp_dir ()
$ Temp_file = tempnam (sys_get_temp_dir (), 'tux ');
Echo $ temp_file;
?>
The above example will output something similar:
C: WindowsTempTuxA318.tmp
Implementation of this function:
If (! Function_exists ('sys _ get_temp_dir ')){
Function sys_get_temp_dir (){
If (! Empty ($ _ ENV ['tmp ']) {return realpath ($ _ ENV ['tmp']);}
If (! Empty ($ _ ENV ['tmpdir']) {return realpath ($ _ ENV ['tmpdir']);}
If (! Empty ($ _ ENV ['temp ']) {return realpath ($ _ ENV ['temp']);}
$ Tempfile = tempnam (uniqid (rand (), TRUE ),'');
If (file_exists ($ tempfile )){
Unlink ($ tempfile );
Return realpath (dirname ($ tempfile ));
}
}
}
?>
Sys_get_temp_dir-return the usage and implementation principles of the temporary file path function. Sys_get_temp_dir (PHP 5 = 5.2.1) paid...