PHP 中的 fwrite() 函数
phpprogrammingserver side programming
fwrite() 函数写入打开的文件。成功时返回写入的字节数,失败时返回 False。
语法
fwrite(file_pointer, string, length)
参数
file_pointer − 使用 fopen() 创建的文件系统指针。必需。
string − 要写入的字符串。必需。
length − 要写入的最大字节数。可选。
返回
fwrite() 函数在成功时返回写入的字节数,而在失败时返回 False。
示例
<?php $file_pointer = fopen("new.txt","w"); echo fwrite($file_pointer,"This is test string!"); fclose($file); ?>
输出
20