【问题标题】:Which file permission to write to text files?写入文本文件的文件权限是什么?
【发布时间】:2017-04-01 08:53:34
【问题描述】:

我的 PHP 脚本写入 text.txt 文件,例如

 $filename = "pref.enc";  // TEXT FILE
    $file_content = file($filename); 
    $x = count($file_content); 
    $fp = fopen($filename, "w+");  
$file_content[0] = "$my_station" . "\n";
    $y = 0; 
    while($y < $x) 
    { 
    fwrite($fp, $file_content[$y]); 
    $y++; 
    } 
    fclose($fp); 

对于文本文件AND文件夹(存放文本文件的文件夹)推荐哪种CHMOD权限?

755 还是 777 ?

【问题讨论】:

    标签: php ftp chmod


    【解决方案1】:
    • 0755 用于目录
    • 0644 用于文件

    chmod

    这是假设您希望每个人都阅读它。

    【讨论】:

      猜你喜欢
      • 2012-02-29
      • 2011-01-20
      • 2015-12-31
      • 2011-08-21
      • 2016-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多