时间:2021-07-01 10:21:17 帮助过:13人阅读
';
$data = '11.txt';$fp = fopen($data, 'r');while($r = fgets($fp)) { $t = join("','", explode(' # ', $r)); $sql = "insert into 表 values ('$t')"; //.... 执行sql}
PHP code?1234567$data = '11.txt';$fp = fopen($data, 'r');while($r = fgets($fp)) { $t = join("','", explode(' # ', $r)); $sql = "insert into 表 values ('$t')"; //.... 执行sql}
不过对于 mysq……
我按照你的这个,然后打开这个页面,直接不显示,空白的~
$data = '11.txt';$fp = fopen($data, 'r');while($r = fgets($fp)) { echo $t = join("','", explode(' # ', $r)); //$sql = "insert into 表 values ('$t')"; //.... 执行sql}
你的数据不是按行按列(" # ")做值得吗?
只有你提供正确的数据和需求,才有可能得到可行的处理方案
$filename="11.txt";$fps=fopen($filename,'r');while(!feof($fps)){$ceshi=fgets($fps);echo $ceshi."
";}fclose($fps);
我没有弄错,列分隔符是“ # ”,即 # 号两边各有一个空格(真难为你了,不嫌烦吗?)
补上字段列表,为
$t = join("','", explode(' # ', $r));
$sql = "insert into 表 ( name, time, bak) values ('$t')";