Use a text file to create a message board prompt (bottom ). Managing your messages in text files is not as convenient as in the database. next we will try to achieve this effect! When outputting data, we use arrays to store data. Therefore, it is not as convenient to manage your messages in text files as in the database. next we will try to achieve this effect!
When outputting data, we use arrays to store data. Therefore, we can easily assign an sequence number to each group of data in order and operate on the sequence number, we can easily modify the data!
$ Date [0] is the first line in the text file. when we output the data, the allocation sequence number is 0.
The output has the following effect:
Modify message
Let's customize modify. php.
If ($ id! = ""){
$ Date = file ("txt/mytxt.txt ");
$ Str = explode ("&", $ date [0])
?>
} Else {
$ Str = $ tech1. "&". $ tech2. "&". $ tech3 ....
If ($ str! = ""){
// Write the modified data back to a text file!
}
}?>
In this process, note that the value of $ id is not lost. when writing back data, read the value in the text into $ date, and then $ date [$ id] = $ str;
$ Fp = fopen ("txt/mytxt.txt", "w ");
Fwrite ($ fp, $ date );
Fclose ($ fp );
Success! In the output, we use an array to save the data, so I...