Home > Backend Development > PHP Tutorial > Specific implementation method of adding data program in PHP_PHP tutorial

Specific implementation method of adding data program in PHP_PHP tutorial

WBOY
Release: 2016-07-15 13:32:27
Original
843 people have browsed it

PHP data adding program code:

  1. $date date=date(”Y-m-d H:i:s”);
  2. //Get system time
  3. $ip = $HTTP_SERVER_VARS[REMOTE_ADDR];
  4. //Get the IP address of the speaker
  5. $text=encode($gb_text);
  6. //Remove the spaces after the message content.
  7. $fp=fopen("gb.dat", "a");
  8. //Open the gb.dat text file in write-only mode, with the file pointer pointing to the end of the file.
  9. $str=$ip.”|”.$date.”|”.$gb_name.”|”.$gb_email.”|”.$gb_home. ”|”.$face.”|”.$gb_qq.”|”.$head.”|”.$text.”|”.$reply.”n”;
  10. //Assign the data of all messages to the variable $str. The purpose of "|" is to use it as the data interval symbol when dividing data in the future.
  11. fwrite($fp,$str);
  12. //Write data to file
  13. fclose($fp);
  14. //Close the file
  15. showmessage("Message successfully!","index.php", "3");
  16. //Leave a message successfully and automatically return to the main interface after 3 seconds.


$gb_name, $gb_email, $gb_home, $face, $gb_qq, $head, $gb_text, $reply in the code of the PHP data program are generated by the speech form transmitted data.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446134.htmlTechArticlePHP data adding program code: $ date date =date(Y-m-dH:i:s); //Get System time$ ip =$HTTP_SERVER_VARS[REMOTE_ADDR]; //Get the speaking IP address$ text = encode ($gb_text); //Remove...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template