php儲存txt檔案入門教程執行個體

來源:互聯網
上載者:User

<html>
<head>
<style type="text/css教程">
<!--
.{ font-family: "宋體"; font-size: 9pt;color:#000000}
-->
</style>
<body bgcolor=#cccccc>
<?
if ($nickname=="") {
print "<center><b><font color=#FF99FF>題目?</font>
";
}
else if ($key=="") {
print "<center><b><font color=#FF99FF>關鍵字?</font>
";
}
else if ($note=="") {
print "<center><b><font color=#FF99FF>內容?</font>
";
}else{
print "<p></p>";
$t = date(Y年m月d日);


$note = str_replace ( "<", "<", $note);
$note = str_replace ( ">", ">", $note);
$note = str_replace ( "n", "
", $note);

$main = "<html>
<head>
<title>Untitled Document</title>

<meta NAME="key" CONTENT=$key>
<meta NAME="name" CONTENT=$nickname>
</head>

<body bgcolor="#E1F0E9">
<table width="700" border="0" align="center" cellspacing="1" cellpadding="0" bgcolor="#006633">
<tr bgcolor="#E0F0E8">
<td height="40"><!-- 題目開始 -->$nickname<!-- 題目結束 --></td>
</tr>
<tr bgcolor="#E0F0E8" valign="top">
<td height="338"><!-- 本文開始 -->$note<!-- 本文結束 --></td>
</tr>
</table>
</body>
</html>
";

$fdd=fopen("count.txt","r");
$cdd=fread($fdd,5);
$cdd++;
fclose($fdd);
$fdd=fopen("count.txt","w");
fwrite($fdd,$cdd);
fclose($fdd);
$ttt=".html";
$n=$cdd.$ttt;
$f = fopen($n,"a");
fwrite($f,$main);
fclose($f);
print "<center><b><font color=#FF99FF>遞交成功</font>
";


}
?>

<p>
</p>
<p>
</p>
<center><a href="input.php">返回</a></center>

</center>
</body>
</html>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#006633">
<form method="POST" action="result.php">
<table width="720" border="0" align="center" bgcolor="#D2E7D1">
<tr>
<td>標題:
<input type=text name=nickname size="50">
</td>
</tr>
<tr>
<td>關鍵字:
<input type=text name=key size="50">
</td>
</tr>
<tr>
<td>
<div align="center">
<p>本文:


<textarea name=note cols="100" rows="20"></textarea>
</p>
</div>
</td>
</tr>

<tr>

<td width=80% align=center><input type="submit" value="確定"><input type="reset" value="重寫">
</td>
</tr>

</table>
</form>
</body>
</html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.