如何使用codeigniter将CSV导入mysql [英] How do I import CSV to mysql using codeigniter
问题描述
我有一个csv文件列表,我想导入到mysql db,使用codeigniter。
我试过 $ this- > load-> library('getcsv');
库,但如何导入csv,而无需将CSV文件上传到服务器,我的意思是只是将文件上传到临时位置,
我想要这样的东西。
HTML: < input type =filename =csv/>
添加到临时字符串
代码: c> $ this-> input-> upload ['tmp_name']
I给出了正确的答案。
这将生成CSV格式的报告。
这将告诉你如何读取和转储csv文件。
I have a list of csv files, which I want to be import to mysql db, using codeigniter.
I tried $this->load->library('getcsv');
library but how to import the csv without uploading the CSV files to the server, what I meant was just uploading the files to a temp location like how pure coding PHP does.
Any idea?
Example:
I wanted something like this.
HTML:<input type="file" name="csv" />
to a temp string
Codeigniter: $this->input->upload['tmp_name']
I gave exactly the answer for this. Take a look at this answer of mine for your problem's solution.
This will generate report in CSV format.
And this will tell you how to read and dump csv files.
Codeigniter REST CSV import to mysql
这篇关于如何使用codeigniter将CSV导入mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!