文件权限和CHMOD:如何在创建文件时在PHP中设置777?
|
保存文件时文件权限有关的问题,当文件不存在时,最初会被创建为新文件。
现在,一切顺利,并且保存的文件似乎处于模式“ 0”。
为了使文件另存为“ 1”模式,我必须在此处更改什么?
感谢您提供的任何提示,线索或答案。我认为与之相关的代码包括:
/* write to file */
self::writeFileContent($path, $value);
/* Write content to file
* @param string $file Save content to wich file
* @param string $content String that needs to be written to the file
* @return bool
*/
private function writeFileContent($file, $content){
$fp = fopen($file, \'w\');
fwrite($fp, $content);
fclose($fp);
return true;
}
没有找到相关结果
已邀请:
3 个回复
傻零凰死授
http://php.net/function.chmod
厢界山攀
手动设置所需的权限:
佬棠
如果您希望所有新文件都具有特定权限,则需要研究设置
。这是一个将默认修改应用于标准模式的过程设置。 这是一个减法。就是说,我的意思是
10ѭ会给您默认权限
(
)。 但是您应该仔细考虑这两个选项。使用该模式创建的文件将完全不受更改保护。