〇〇六章 php读取csv文件

释放双眼,带上耳机,听听看~!

<?php
$handle = fopen(“1.csv”,”r”);
while ($data = fgetcsv($handle, 1000, “,”)) {
$data = eval(‘return ‘.iconv(‘gbk’,’utf-8′,var_export($data,true)).’;’);//修正乱码
echo $data[0].$data[1].$data[2].$data[3].$data[4].$data[5].$data[6].$data[7].$data[8].”<br>/n”;
//插入数据库
$sql = “insert into tb_shucai(leibie, name,danwei,price1,youxiaoqi) values(‘”.$data[0].”‘,'”.$data[1].”‘,'”.$data[2].”‘,'”.$data[4].”‘,'”.$data[8].”‘)”;
$ret = mysql_query($sql, $link);
}
fclose($handle);
?>

【转自慕课】https://www.imooc.com

PHP

高性能队列Disruptor系列3--Disruptor的简单使用

2022-3-3 18:27:27

PHP

Laravel API 的访问频率限制

2022-3-3 18:27:57

搜索