制作简单的留言簿 [英] making a simple guestbook
问题描述
如果您有一个html并将其汇总到一个基本的PHP文件接收器中,我想知道如何将它们加起来.您如何使提交的表单堆栈,而不是每个提交都替换另一个?我不知道从哪里开始寻找答案.
If you have an html and you sumbit it to a basic PHP file receiver, I wonder how you make them add up. how do you make the submitted forms stack instead of each submission replacing the other? I have no clue where to even start looking for an answer.
包装打印语句并使包装元素成为数组? 我是否需要文件I/O以便消息存储在某处?
wrap print statements and make wrap element an array? do i need file I/O for this so the messages get stored somewhere?
目前,PHP对我来说是一个非常混乱的丛林.请注意,在我的课程中,我还没有进入php的数据库部分.
PHP is a very confusing jungle for me at the moment. Note that I haven't gotten to the database part of php in my course yet.
非常感谢
推荐答案
当然,您将需要文件I/O来存储消息.
否则应该如何保存它们?
因此,您必须将消息保存在文件中.
Of course you will need file I/O to store messages.
Otherwise how they are supposed to be saved?
So, you have to save your messages in a file.
要在文件底部添加新数据,您必须将其添加而不是重写.
To add new data at the bottom of the file you have to append it instead of rewriting.
如果使用的是file_put_contents
函数,请将其与FILE_APPEND标志一起使用:
if you're using file_put_contents
function, use it with FILE_APPEND flag:
file_put_contents($file, $data, FILE_APPEND);
如果使用的是fopen()
,请使用'a'
模式而不是'w'
if you're using fopen()
, use 'a'
mode instead of 'w'
这篇关于制作简单的留言簿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!