最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php sys_get_temp_dir -返回临时文件路径
时间:2022-07-02 09:28:03 编辑:袖梨 来源:一聚教程网
sys_get_temp_dir
( PHP 5中“ = 5.2.1 )
sys_get_temp_dir -返回目录路径用于临时文件
描述
字符串sys_get_temp_dir (无效)
返回目录路径的PHP商店临时文件在默认情况下。
返回值
返回路径的临时目录中。
实例
例如# 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 to:
C:WindowsTempTuxA318.tmp
此函数的实现方法:
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));
}
}
}
?>
相关文章
- 原神大伟丘在哪里-原神大伟丘位置 07-02
- photoshop将普通照片制作成超赞的仿线描效果教程 07-02
- 部落冲突荣耀加冕怎么打-部落冲突荣耀加冕活动攻略 07-02
- 阴阳师2025年残局得胜怎么打-阴阳师残局得胜攻略 07-02
- BDB Coin(BDB币)挖矿的原理 07-02
- Botanix L2主网上线,将比特币区块时间缩短至5秒 07-02