The data submitted by php is generated as a txt file ,. The data submitted by php is generated as a txt file. There are two files in total. the specific link to the database is directly removed. the front-end is the submitted text part, one row at a time, after the submission, the data submitted by another php file is generated as a txt file,
There are two files in total. the specific link to the database is directly removed. the front-end is the submitted text part, one line, and the other program file is processed after the submission, then generate the corresponding txt file according to the submitted file name and add data to the txt file. before using the file, create a test file in the root directory.
The front-end form file is as follows (saved as dcwz. php ):
<? Phperror_reporting (0); // require_once (".. /config. php "); // require_once (".. /admin/ly_check.php "); // $ SQL =" select * from leibie "; // $ rs = mysql_query ($ SQL);?>
Untitled Document
The processing program for generating txt files is as follows (saved as dcwj_cl.php ):
<? Php $ biaoti_cl = explode ("\ n", $ biaoti); $ biaoti_num = count ($ biaoti_cl); $ file_type = "txt"; for ($ I = 0; $ I <$ biaoti_num; $ I ++) {$ file_name = mb_convert_encoding ($ biaoti_cl [$ I], 'gbk', "UTF-8 "); $ data [] = array ("tom", "boy", 20); $ dir = dirname (_ FILE __). "\ text \"; $ string = ""; foreach ($ data as $ k => $ v) {foreach ($ v as $ vstr) {$ string. = mb_convert_encoding ($ vstr, 'gbk', "UTF-8") ;}}$ string. = "\ r \ n"; $ filedir = $ dir. trim ($ file_name ). ". ". $ file_type; $ fileurl = str_replace ('','', $ filedir); $ fp = fopen ($ fileurl, "a +"); echo 'create '. $ fileurl.'
'; Fwrite ($ fp, $ string); fclose ($ fp) ;}?>
The above is all the content of this article. I hope it will help you learn php programming.
Commit. There are two files in total. the specific link to the database is directly removed. the foreground is the submitted text part, one line, and the other after the submission...