PHP中的fwrite()函数
该fwrite()函数将写入打开的文件。它返回成功写入的字节数,而失败则返回False。
语法
fwrite(file_pointer, string, length)
参数
file_pointer-使用创建的文件系统指针fopen()。需要。
string-要写入的字符串。需要。
长度-的最大字节数被写入。可选的。
返回
该fwrite()函数返回成功写入的字节数,而失败则返回False。
示例
<?php
$file_pointer = fopen("new.txt","w");
echo fwrite($file_pointer,"这是测试字符串!");
fclose($file);
?>输出结果
20