基于 PHP 的聊天室(二)
现在我们终于有了写新文件所需的所有东西了: ?php // 打开文件,并且将文件长度截为0 $open_file = fopen(messages.html, w); // 写入文件的头信息 fputs($open_file, $header); // 新的一行 // (使用strip
现在我们终于有了写新文件所需的所有东西了:
<?php
// 打开文件,并且将文件长度截为0
$open_file = fopen("messages.html", "w");
// 写入文件的头信息
fputs($open_file, $header);
// 新的一行
// (使用stripSlashes,因为我们不想让所有的转义字符出现在消息文件中)
fputs($open_file, stripslashes($new_message));
// 旧的行
fputs($open_file, $old_messages);
// 脚标
fputs($open_file, $footer);
// 关闭文件
fclose($open_file);
?>
摘自:http://www.9headbird.com/detail.php3?id=8970
<?php
// 打开文件,并且将文件长度截为0
$open_file = fopen("messages.html", "w");
// 写入文件的头信息
fputs($open_file, $header);
// 新的一行
// (使用stripSlashes,因为我们不想让所有的转义字符出现在消息文件中)
fputs($open_file, stripslashes($new_message));
// 旧的行
fputs($open_file, $old_messages);
// 脚标
fputs($open_file, $footer);
// 关闭文件
fclose($open_file);
?>
摘自:http://www.9headbird.com/detail.php3?id=8970
- 上一篇:基于 PHP 的聊天室(一)
- 下一篇:基于 PHP 的聊天室(三)
精彩图集
精彩文章