![]() |
如何将数据从txt导入到mysql
<?
//mysql连接。。。。。 $f=file("路径/文本文件.txt"); for($i=0;$i<count($f);$i++){ $arr=explode(",",$f[$i]); //建议文本文件中用“|”号分隔字段,用“,”的程序可读性差 mysql_query("insert into student values('$arr[0]','$arr[1]','$arr[2]','$arr[3]')"); } ?> |
| All times are GMT +8. The time now is 03:35 AM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.