Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
$fp = fopen('a.html', 'w'); fwrite($fp, 'Done');
效果很好但是
$fp = fopen('b.php', 'w'); fwrite($fp, 'Done');
不工作。可能的解决方案是什么?
预先感谢。
更新: 1:echo fwrite($fp, 'Done')打印 4。没有错误。并且文件保持不变。不适fwrite()用于php文件?2:我在本地服务器上执行此操作,并且我拥有所有权限。
echo fwrite($fp, 'Done')
fwrite()
$fp = fopen('a.html', 'w'); fwrite($fp, 'Done'); fclose($fp); $fp = fopen('b.php', 'w'); fwrite($fp, 'Done'); fclose($fp);
使用 fclose($fp);
检查您的文件权限,也许您没有对此文件的写入权限