fwrite()
函數在 PHP 中用于將數據寫入文件
fopen()
函數可以接受以下模式參數:
在使用 fwrite()
時,首先需要使用 fopen()
函數以指定的模式打開文件。然后,使用 fwrite()
函數將數據寫入文件。最后,使用 fclose()
函數關閉文件。
示例:
$file = fopen("example.txt", "w"); // 以寫入模式打開文件
fwrite($file, "Hello, World!"); // 將數據寫入文件
fclose($file); // 關閉文件