Code for adding a Data Program to PHP:
- $ Datedate = date ("Y-m-d H: I: s ");
- // Obtain the system time
- $ Ip = $ HTTP_SERVER_VARS [REMOTE_ADDR];
- // Obtain the IP address of the speaker
- $ Text = encode ($ gb_text );
- // Remove the spaces behind the message content.
- $ Fp = fopen ("gb. dat", "");
- // Open the gb. dat text file in write-only mode. The file Pointer Points to the end of the file.
- $ Str = $ ip. "| ". $ date. "| ". $ gb_name. "| ". $ gb_email. "| ". $ gb_home. "| ". $ face. "| ". $ gb_qq. "| ". $ head. "| ". $ text. "| ". $ reply. "n ";
- // Assign the variable $ str, "|" to the data interval symbol used for data segmentation in the future.
- Fwrite ($ fp, $ str );
- // Write data to a file
- Fclose ($ fp );
- // Close the file
- Showmessage ("message successful !"," Index. php "," 3 ″);
- // Message success. The message is automatically returned to the main interface 3 seconds later.
The $ gb_name, $ gb_email, $ gb_home, $ face, $ gb_qq, $ head, $ gb_text, and $ reply values in the PHP code added to the Data Program are data transmitted from the speech form.