PHP创建随机tmp文件并获取其完整路径 [英] PHP create random tmp file and get its full path

查看:172
本文介绍了PHP创建随机tmp文件并获取其完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



  $ temp = tmpfile(); 
fwrite($ temp,写入tempfile);

我想得到 $ temp 文件 tmpfile 已创建。

我需要做些什么来获取这些信息?

解决方案

  $ path = tempnam(sys_get_temp_dir(),'prefix'); 

请参阅这个例子


After I do:

$temp = tmpfile();
fwrite($temp, "writing to tempfile");

I'd like to get a full path to the $temp file that tmpfile has created.

What do I need to do to get that information?

解决方案

$path = tempnam(sys_get_temp_dir(), 'prefix');

See this example.

这篇关于PHP创建随机tmp文件并获取其完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆