<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $cn = mysql_connect('localhost','root','');if( $cn ){ $files=glob("*.txt"); foreach($files as $file) unlink($file);mysql_connect("106.187.43.139", "caijizhi_123", "7898585") or die("Could not connect: " . mysql_error()); mysql_select_db("caijizhi_123"); $result = mysql_query("SELECT title FROM cjx_archives") or die(mysql_error()); $file_index=1; $i=1; while ($row = mysql_fetch_array($result, MYSQL_NUM)) { if(! ($i % 150) ) $file_index++;$i++; file_put_contents ( $file_index.'.txt' , $row[0]. PHP_EOL, FILE_APPEND ); } mysql_free_result($result); }else{ die('连接失败');}?>//先定义好 $prefix, $suffix的值,说白了就是字符串连接问题。。你能写这些代码,字符串连接不会?file_put_contents ( $file_index.'.txt' , $prefix . $row[0] . $suffix . PHP_EOL, FILE_APPEND );<div class="clear"></div>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号