Local leaders message board with text file making message board tips (ON)

Source: Internet
Author: User
The first is to ensure that the text file can read and write, before the file is ready to write, we have to do is to handle the user message!
This work can be done before the submission of the form, we will get the data are separated by a specific symbol, for example, with the &, it is worth noting that if the data submitted if there is a specific character, then we have to convert him into other forms, which you have your own way;
If we get the data shape like:
$str = "AAAAA&BBBBB&CCCCC&DDDDD";
Before we write the data to the file, we add
$str = $str. " \ r \ n "
Then execute:
$FP =fopen ("Txt/mytxt.txt", "a");
Fwrite ($fp, $txt);
Fclose ($FP);
So the data we write is at the end of the file.
How to make the latest message appear in the message board first?
The data has the above processing, it is good to run,
$date =file ("Txt/mytxt.txt");
$n =count ($date);
for ($I = $n; $I >0; $I--) {
$str =explode ("&", $date [$I])
.
Will get the output of the $STR array.
.
}
So the latest inserted message will remain in the first place.

The above introduces the local people's Daily information board with a text file to create message board tips (on), including the local leaders of the daily Information Board of the content, I hope that the PHP tutorial interested friends have some help.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.