Creating temp directory on server

早过忘川 提交于 2020-01-07 08:23:13

问题


Is it possible to create a temporary directory on a hosting server with the same functionality as the tmp folder in the root directory?

I need a second tmp folder to temporary store files that I'm uploading to another web service. I want to avoid unlink() functions or cron jobs for deleting files.


回答1:


Yes you can .... using System::mktemp

$tempfile = System::mktemp("prefix");       
$tempdir  = System::mktemp("-d prefix");
$tempfile = System::mktemp();
$tempfile = System::mktemp("-t /var/tmp prefix");

Or you can run the command using exec

  mktemp  make temporary dirname


来源:https://stackoverflow.com/questions/12874883/creating-temp-directory-on-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!