This article describes an example of a small guestbook for php file operation. Share it with everyone for your reference. The details are as follows:
The Index.php file is as follows:
?
2 3
|
Title: ".fgets($fs)." "; echo "Author: ".fgets($fs)." "; echo "Content: ".fread($fs, filesize($path.$filen)).""; echo " "; fclose($fs); } } closedir($dr) //Close the directory ?> |
1 2 3 4 5 6 7 8 9 10 11 | <🎜>$path = "DB/";<🎜> <🎜>$filename = "S".date("YmdHis").".dat";<🎜> <🎜>$fp = fopen($path.$filename, "w");<🎜> <🎜>fwrite($fp, $_POST["title"]."/n");<🎜> <🎜>fwrite($fp, $_POST["author"]."/n");<🎜> <🎜>fwrite($fp, $_POST["content"]."/n");<🎜> <🎜>fclose($fp);<🎜> <🎜>echo "Message posted successfully!";<🎜> <🎜>echo "Return to homepage"; ?> |
?
2 3 11 12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<🎜>"http://www.w3.org/TR/html4/loose.dtd">
发表新的留言 |