PHP - 在表单上提交具有新名称的重复文件夹

时间:2015-06-14 16:32:55

标签: php apache permissions directory

php是否可以创建一个包含某些文件的新目录。

例如,当php代码被激活时,它会使用它自己的名称复制我的服务器目录中的文件夹吗?

如果有人能提供我需要的代码的开头,我将非常感激。

汤姆

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

if(!file_exists('folderName')) {
    mkdir('folderName', '0777', true);

    $path = realpath('folderName');
    $file = fopen($path . "/file1.txt", 'w') or die("Could not open the file");
}