Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
mkdir('..'.$this->path.$user, 0777);
我正在尝试在我的服务器上创建一个具有写权限的目录,以便可以将上传的图像写入其中。
我执行上述操作,但是当我检查创建的文件夹的写权限时,它是 755。
有谁知道为什么?
首先想到的是umask。
umask
$old = umask(0); mkdir('..' . $this->path . $user, 0777); umask($old);
此外,您可以尝试在使用创建后设置文件夹权限chmod。
chmod
mkdir('..' . $this->path . $user); chmod('..' . $this->path . $user, 0777);
是的,我知道,这是 Linux 目录的默认权限。
您可以更改它umask,请参阅http://php.net/umask