最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php实现的读取CSV文件函数示例
时间:2022-06-24 14:56:55 编辑:袖梨 来源:一聚教程网
代码如下 | 复制代码 |
functionread_csv($cvs) { $shuang= false; $str=file_get_contents($cvs); for($i=0;$i if($str{$i}=='"') { if($shuang) { if($str{$i+1}=='"') { $str{$i} ='*'; $str{$i+1} ='*'; }else{ $shuang= false; } }else{ $shuang= true; } } if($str{$i}==',') { if($shuang) { }else{ $str{$i} ='|'; } } if($str{$i}=="n") { if($shuang) { $str{$i} ='^'; }else{ } } } $str=str_replace(array('"','*'),array('','"'),$str); $a1=explode("n",$str); $array=array(); foreach($a1as$k=>$value) { if($value) { $value=str_replace("^","n",$value); $array[$k] =explode("|",$value); } } return$array; } |
相关文章
- 和平精英PC模拟器怎么切换投掷武器-投掷物切换方法 08-14
- 和平精英PC模拟器ui怎么换回原来的-新旧UI切换方法 08-14
- 和平精英PC模拟器怎么唤出鼠标-鼠标唤出键位介绍 08-14
- 和平精英PC模拟器画质怎么调最清晰-画质设置教程 08-14
- 和平精英PC模拟器配置要求高吗-配置要求介绍 08-14
- 和平精英PC模拟器能和手机一起玩吗-多平台匹配机制介绍 08-14