1. Go to this page and download the library: Download wujiangweiphp/yieldcsv library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wujiangweiphp / yieldcsv example snippets
$yieldCsv = new YieldCsv();
$query_info = array(
'file_name'=>'your file path',
'fields'=> array(
'id' => '编号',
'nickname' => '昵称',
'age' => '年龄',
'desc' => '简介'
)
);
$data = $yieldCsv->getFileData($query_info,1);
foreach($data as $k => $v){
// your oper to insert to mysql
}