gpt4 book ai didi

php - fopen : failed to open stream: Permission denied in PHP on Mac

转载 作者:可可西里 更新时间:2023-11-01 00:19:06 26 4
gpt4 key购买 nike

<分区>

我写了这段代码:

if (file_exists("testfile.rtf")) echo "file exists.";
else echo "file doesn't exist.";

$fh = fopen("testfile.rtf", 'w') or die("impossible to open the file");

$text = <<< _END
Hi buddies,
I write for the first time
in a PHP file!
_END;

fwrite($fh, $text) or die("Impossible to write in the file");
fclose($fh);
echo ("writing in the file 'testfile.rtf' succeed.");

但是当我运行它时它说:

fopen(testfile.rtf): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/test/test1.php on line 64 impossible to open the file

我在我的 MAC 上使用 XAMPP 在本地服务器上工作。

我发现了几个主题,其中一些人遇到了同样的问题,并使用名为“chmod 777”的东西解决了它,但我不知道那是什么意思,也不知道该在哪里写等等。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com