首页 > PHP教程 > PHP常用函数手册 > PHP 文件系统函数

PHP fwrite() 函数

 函数原型

/**

 * 向打开的文件写入内容(二进制安全)

 * @link http://php.net/manual/en/function.fwrite.php

 * @param resource $handle 由fopen函数返回的文件指针

 * @param string $string  要写入的字符串

 * @param int $length [optional]  写入 length 个字节或者写完了 string 后,就停止

 * @return int  返回写入的字符数,出现错误时则返回 FALSE 

 * @since 4.0

 * @since 5.0

 */

function fwrite ($handle, $string, $length = null) {}

 

函数示例

<?php

$file = fopen("a.txt","w");

echo fwrite($file,"Hello World");

fclose($file);

?>

关闭
感谢您的支持,我会继续努力!
扫码打赏,建议金额1-10元


提醒:打赏金额将直接进入对方账号,无法退款,请您谨慎操作。