在PHP中使用mkdir()获取动态创建的文件夹名称 [英] Getting a dynamically created folder name using mkdir() in PHP

查看:223
本文介绍了在PHP中使用mkdir()获取动态创建的文件夹名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

mkdir("Userfiles/".$company."_".$time_stamp); 

我想将该目录保存到变量或任何其他变量中,并且必须使用目录名将我的.txt文件保存在其中

I want to save that directory in a variable or any other and I have to use the directory name for saving my .txt files in it

$myFile = "exfiles/".str_replace(" ","-",$_POST['company'])."_CC Booth furnishings ".$order_type."_".$time_stamp.".txt";

代替"exfiles",我需要提供动态创建的目录名称. 任何帮助将不胜感激. 谢谢

In the place of 'exfiles' I need to give the dynamically created directory name. Any help will be appreciated. Thanks

推荐答案

$dirname = "Userfiles/".$company."_".$time_stamp;
mkdir($dirname);
$myFile = $dirname . str_replace(" ","-",$_POST['company'])."_CC Booth furnishings ".$order_type."_".$time_stamp.".txt";

如您的问题评论中所述:

As stated in the comments of your question:

不要直接使用$ _POST数据来操纵服务器上的文件.始终对其进行消毒

这篇关于在PHP中使用mkdir()获取动态创建的文件夹名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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