mkdir()没有在linux服务器上创建文件夹

时间:2015-01-22 15:11:02

标签: php mkdir

是的,我在我的本地服务器上工作了,这是Windows Server 2012,但是在托管时我现在在linux服务器上。

当用户提交表单时,它应运行此代码

代码:

$target_dir = "docs". "/";
//IF/ELSE the folder is already created...
    if(!file_exists($target_dir . $ref . "/"))
    {//Create folder named 1 inside the customer ref folder.
        mkdir($target_dir . $ref . "/" . "1" . "/", 0775, true);
        $count = 0;
    }else
    {//Create new folder inside customer ref folder 
        //count the amount of folders inside docs/$ref/
        $find_folders = glob($target_dir . $ref . "/" . "*",GLOB_ONLYDIR);
        $count = count($find_folders);
        //create new folder inside $ref/ using count+1 to make the folder increase by 1
            $new_folder = $count +1;
            mkdir($target_dir . $ref . "/" . $new_folder . "/", 0775, true);        
    }
            //IF count exists then the $target_file changes to the new folder...
                if($count > 0)
                    {
                        $target_file = $target_dir . $ref . "/" . $new_folder . "/";  
                    }else
                    {//else use first directory
                        $target_file = $target_dir . $ref . "/" . "1" . "/";
                    }

在我的Windows服务器上,每个单词“/”你看到我正在使用DIRECTORY_SEPARATOR但是假设是linux,它需要更改为正斜杠。现在这不起作用。任何迪亚斯为什么?

0 个答案:

没有答案