Php 如何将文件的属性设置为0777?

Php 如何将文件的属性设置为0777?,php,Php,如何将通过php创建的文件的属性设置为0777 $myFile = "test.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = 'test'; fwrite($fh, $stringData); fclose($fh); 根据:您可以使用chmod保护您的文件。以下是一个例子: chmod($myFile, 0777); 看看。你不能 你有两个选择-设置后使用或使用前。在后一种情况下,您需要将其

如何将通过php创建的文件的属性设置为0777

$myFile = "test.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = 'test';
fwrite($fh, $stringData);
fclose($fh);

根据:

您可以使用chmod保护您的文件。以下是一个例子:

chmod($myFile, 0777);
看看。

你不能

你有两个选择-设置后使用或使用前。在后一种情况下,您需要将其恢复到不破坏其他代码的状态,这取决于原始umask值(如果有)。

这就是您想要的吗?
chmod($myFile, 0777);