PHP mkdir($ recursive = true)跳过上一个目录 [英] PHP mkdir( $recursive = true ) skips last directory

查看:459
本文介绍了PHP mkdir($ recursive = true)跳过上一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP 5.2.4(没有safe_mode)的linux服务器上有下面这段代码:

  mkdir ($ path,0777,true); 

当我输入路径时:

'/ path / to / create / recur /自动/'



< p $>
当我添加另一个目录时:

 ' / path / to / create / recur / ively / more /'

对于最后一个...

已经尝试过和没有尾随斜线

可以any1在这里启发我请问?

解决方案

好的解决方法如下:没有问题。

我没有单独测试代码,只是假设下面的代码没有对目录结构做任何事情...

我发现目录后来被代码本身删除。



无论如何,经验教训...


I've got the following piece of code on a PHP 5.2.4 (no safe_mode) linux server:

mkdir( $path, 0777, true );

when I enter a path like:

'/path/to/create/recur/ively/'

all directories are created except for the last one... when I add another directory like:

'/path/to/create/recur/ively/more/'

again, all paths are created except for the last one...

have tried both with and without trailing slashes

Can any1 enlighten me here please?

解决方案

Ok the solutions is as follows: there was no problem.

I did not test the code in isolation, but only assumed the following code was not doing anything to the directory structure...

as I found out the directory got deleted later on by the code itself.

Anyway, Lesson learned...

这篇关于PHP mkdir($ recursive = true)跳过上一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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