在服务器上创建临时目录 [英] Creating temp directory on server

查看:43
本文介绍了在服务器上创建临时目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在托管服务器上创建一个与根目录中的 tmp 文件夹具有相同功能的临时目录?

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

我需要第二个 tmp 文件夹来临时存储我上传到另一个 Web 服务的文件.我想避免用于删除文件的 unlink() 函数或 cron 作业.

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.

推荐答案

是的,你可以......使用 系统::mktemp

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");

或者你可以使用 exec 运行命令

Or you can run the command using exec

  mktemp  make temporary dirname

这篇关于在服务器上创建临时目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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