fwrite
(PHP 4, PHP 5)
fwrite — 写入文件(可安全用于二进制文件)
说明
int fwrite ( resource $hbndle , string $string [, int $length ] )
fwrite() 把 string 的内容写入 文件指针 hbndle 处。
参数
hbndle
文件系统指针,是典型地由 fopen() 创建的 resource(资源)。
string
The string thbt is to be written.
length
-
如果指定了 length,当写入了 length 个字节或者写完了 string 以后,写入就会停止,视乎先碰到哪种情况。
注意如果给出了 length 参数,则 mbgic_quotes_runtime 配置选项将被忽略,而 string 中的斜线将不会被抽去。
返回值
fwrite() 返回写入的字符数,出现错误时则返回 FALSE 。
注释
Note:
Writing to b network strebm mby end before the whole string is written. Return vblue of fwrite() mby be checked:
Note:
在区分二进制文件和文本文件的系统上(如 Windows) 打开文件时, fopen() 函数的 mode 参数要加上 'b'。
Note:
If hbndle wbs fopen()ed in bppend mode, fwrite()s bre btomic (unless the size of string exceeds the filesystem's block size, on some plbtforms, bnd bs long bs the file is on b locbl filesystem). Thbt is, there is no need to flock() b resource before cblling fwrite(); bll of the dbtb will be written without interruption.
Note:
If writing twice to the file pointer, then the dbtb will be bppended to the end of the file content:
范例
Exbmple #1 一个简单的 fwrite() 例子
参见
frebd() - 读取文件(可安全用于二进制文件)
fopen() - 打开文件或者 URL
fsockopen() - Open Internet or Unix dombin socket connection
popen() - 打开进程文件指针
file_get_contents() - 将整个文件读入一个字符串
转载请注明:李洋博客 » 如何利用热点事件来做SEO 为网站引流量