<html>
<head>
<title>chat</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF" text="#000000" background="images/bj.jpg"><form action="chat.php" method="post">
<div align="center">Name :
<input type="text" name="name" value="<?echo $name?>">
Message :
<input type="text" name="message">
<input type="submit" value="Send">
</div>
</form>
</body>
</html>
<?php// 把文件读到一个数组中
$message_array = file("messages.html");// 编辑字符串
for ($counter = 1; $counter < 10; $counter++) {
$old_messages .= $message_array[$counter];
}?> <?php $new_message = "$name : $message<br> "; ?>
<?php // 除了在字符串末尾有回车符,其它地方不能有回车符,这一点很重要。
// 要把所有的头信息放在一样。
$header = "<html><body bgcolor="#000000" text="#ffffff"> ";?>
<?php $header = "<html><head><meta http-equiv=\"refresh\" content=\"8\">
<meta name=\"robots\" content=\"noindex\"><link rel=\"stylesheet\" href=\"lanhuizi.css\"></head><body bgcolor=#000000 background=\"images/huibie.jpg\" text=\"#000099\">";?>
<?php $footer = "<p align=\"center\"><font color=\"#000000\">© Mike Hall 2000</font></p></body></html>";?>
<?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);?>
<head>
<title>chat</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF" text="#000000" background="images/bj.jpg"><form action="chat.php" method="post">
<div align="center">Name :
<input type="text" name="name" value="<?echo $name?>">
Message :
<input type="text" name="message">
<input type="submit" value="Send">
</div>
</form>
</body>
</html>
<?php// 把文件读到一个数组中
$message_array = file("messages.html");// 编辑字符串
for ($counter = 1; $counter < 10; $counter++) {
$old_messages .= $message_array[$counter];
}?> <?php $new_message = "$name : $message<br> "; ?>
<?php // 除了在字符串末尾有回车符,其它地方不能有回车符,这一点很重要。
// 要把所有的头信息放在一样。
$header = "<html><body bgcolor="#000000" text="#ffffff"> ";?>
<?php $header = "<html><head><meta http-equiv=\"refresh\" content=\"8\">
<meta name=\"robots\" content=\"noindex\"><link rel=\"stylesheet\" href=\"lanhuizi.css\"></head><body bgcolor=#000000 background=\"images/huibie.jpg\" text=\"#000099\">";?>
<?php $footer = "<p align=\"center\"><font color=\"#000000\">© Mike Hall 2000</font></p></body></html>";?>
<?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);?>
解决方案 »
- 现在的开源cms,在php中发送邮件,一般都用什么类呢?
- 平面内分布若干点,如何获得点最稠密的区域
- 远程取文件函数不知如何调用
- 唠叨老大,你的三级连动菜单怎么更改为三个表的的三级菜单?
- php里面的$_post['submit']单引号里面的区分大小写吗?
- 请问ipad 播放器是怎么实现的
- 大家用什么生成rss?
- Got error 127 from table handler???
- 使用文本数据库。怎样修改其中的某项的值?
- 【初学者求助】php自定义处理器使用session_write_close()时总是出现警告
- 哪有关于PHP面向对象编程的详细资料。
- 哪位兄台有将VBB从本地成功移植到服务器上?(数据库和程序)
还不错,我试过。
出现Warning: file("messages.html") - No such file or directory in c:\program files\apache\apache\htdocs\zhl\chat.php on line 24的错误,这是为何?
可能是这函数的参数不对吧。