我有一个文件“tw.txt”,其中包含文本“测试文本”。
如果我尝试在“tx.txt”中用 写“lol” fwrite
,则内容(“测试文本”)将被简单地删除而不是替换。
服务器没有显示错误,但是,我可以看到我的Error: can't write in file.
CHMOD
在每个文件和文件夹中设置为 777,从“var”代表到网站文件夹。如果我尝试用 读取文件fopen
,没问题。我试图chmod
用 PHP 改变...没有成功。我试图追加,它擦除。
该代码在另外两台服务器上运行良好。
有什么线索吗?谢谢。
<?php
ini_set('display_errors', 'On');
ini_set('allow_url_fopen', '1');
error_reporting(E_ALL);
$fd=fopen("tw.txt","w") or die("Error: can't open file.");
//chmod("tw.txt", 511);
fwrite($fd,"lol") or die('Error: can't write in file.');
fclose($fd);
?>