zoukankan      html  css  js  c++  java
  • PHP读取csv文件

    <?php    
            
             //取数据
            $f_d = file_get_contents('tpl_import_info.csv');
            $f_d = iconv('gbk', 'utf-8', $f_d);
            file_put_contents('tpl_import_info.csv',$f_d);
            setlocale(LC_ALL,'zh_CN.UTF-8');   //解决fgetcsv处理中文失败的问题
            $hl = fopen('tpl_import_info.csv','r');
            $row_i = 0;
            $data = $total = array();
            while ($file_data = fgetcsv($hl)) {
                ++$row_i;
                $name   = $file_data[0];
                $adress = $file_data[1];
                $phone  = $file_data[2];
          
                $data['name'] = $name;
                $data['adress'] = $adress;
                $data['phone'] = $phone;
                $total[]=$data;
               }
             
            fclose($hl);
            var_dump($total);
  • 相关阅读:
    填充与复制
    张量排序
    数据统计
    合并与分割
    前向传播(张量)- 实战
    数学运算
    Broadcasting
    TensorFlow2-维度变换
    集合3
    集合2
  • 原文地址:https://www.cnblogs.com/wicub/p/3317557.html
Copyright © 2011-2022 走看看