PHP implements file guestbook

We have talked so much about file processing systems, but we can't even write the most basic thing.

Starting from this section, you will find that you can write more and more things.

Next let’s take a look at the demonstration effect:

The form interface for writing message content in the following interface:

444.png

The display interface after leaving a message:

document_2015-09-09_55efe0764ff3c.png


Let’s take a look at thefile structure:

index.php ---Display input box and message content
write.php ---Write data to message.txt
message.txt ---Save chat content

index.php File

' . $username . '内容为' . $content . '时间为' . date('Y-m-d H:i:s', $time); echo '
'; } } ?>

基于文件的留言本演示

用户名:
留言内容:

After looking at the display content just now, we know that when the file is stored:

1. The segments are divided into segments

2. The content is the same as what the user has previously used A special symbol is used to separate it.

Let’s write write.php code to write messages to the file:


Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!