首先写前端:写在10.html页面上
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"lang="zh-CN"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>10</title><metaname="description"content="" /></head><body><formaction="10.php"method="post"><inputtype="text"name="title"/><inputtype="text"name="content"/><inputtype="submit" /></form></body></html>
10.php 想txt文本中写入内容
<?php$str=$_POST['title'].','.$_POST['content']. "\n";
$fh=fopen('1.txt', 'a');
fwrite($fh, $str);
fclose($fh);
echo"ok";
?>msg.php 留言本标题列表页
系统易学易懂,用户只需会上网、不需学习编程及任何语言,只要使用该系统平台,只要会打字,即可在线直接完成建站所有工作。本程序适合不懂php环境配置的新手用来在本机调试智能SiteSEO网站优化软件,安装过程极其简单。您的网站地址:http://localhost您的网站后台:登录地址: http://localhost/admin.php密 码: admin服务器套件所包含的软件:nginx-0.7
<?php header("Content-Type:text/html;charset=utf8");
$fh=fopen('1.txt', 'r');
$i=1;
while (($str = fgetcsv($fh))!=false) {
echo'<li><a href="msgtid.php?tid=',$i,'">',$str[0],'</a></li>';
$i=$i+1;
}
?>redmsg.php 内容页
<?php header("Content-Type:text/html;charset=utf8");
$fh=fopen('1.txt', 'r');
$i=1;
while (($str = fgetcsv($fh))!=false) {
if ($i==$_GET['tid']) {
echo'<li>',$str[0],'</li><br/>';
echo'<li>',$str[1],'</li><br/>';
}
$i=1+$i;
}
?>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介绍了 简单的php留言本例子温习,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。










