function System::tmpdir
Get the path of the temporal directory set in the system by looking in its environments variables. Note: php.ini-recommended removes the "E" from the variables_order setting, making unavaible the $_ENV array, that s why we do tests with _ENV
Return value
string The temporary directory on the system
1 call to System::tmpdir()
- System::mktemp in vendor/
pear/ pear-core-minimal/ src/ System.php - Creates temporary files or directories. This function will remove the created files when the scripts finish its execution.
File
-
vendor/
pear/ pear-core-minimal/ src/ System.php, line 463
Class
- System
- System offers cross platform compatible system functions
Code
public static function tmpdir() {
if (OS_WINDOWS) {
if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) {
return $var;
}
if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) {
return $var;
}
if ($var = isset($_ENV['USERPROFILE']) ? $_ENV['USERPROFILE'] : getenv('USERPROFILE')) {
return $var;
}
if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) {
return $var;
}
return getenv('SystemRoot') . '\\temp';
}
if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) {
return $var;
}
return realpath(function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : '/tmp');
}