Ali*_*xel 7 php permissions chmod mkdir
当使用mkdir()recursive标志设置为true时,所有创建的目录是否获得指定的chmod或只是最后一个?例如:
mkdir('/doesnotExist1/doesnotExist2/doesnotExist3/', 0755, true);
Run Code Online (Sandbox Code Playgroud)
新创建的目录将/doesnotExist1/和/doesnotExist1/doesnotExist2/也得到了CHMOD为同一/doesnotExist1/doesnotExist2/doesnotExist3/= 0755?
如果没有,有没有办法强制上述行为?
我会自己测试一下,但是我无法使用*nix盒子ATM.
刚刚使用PHP 5.2.12在gentoo linux上测试过:它们都具有相同的权限.
soulmerge@shark-g:~$ php -a
Interactive shell
php > mkdir('asd/def/ghi', 0700, 1);
php > ^C
soulmerge@shark-g:~$ ls -hal asd
total 12K
drwx------ 3 soulmerge soulmerge 4.0K 2010-01-12 10:32 .
drwxr-xr-x 79 soulmerge soulmerge 4.0K 2010-01-12 10:32 ..
drwx------ 3 soulmerge soulmerge 4.0K 2010-01-12 10:32 def
Run Code Online (Sandbox Code Playgroud)