如何使用codeigniter将CSV导入mysql [英] How do I import CSV to mysql using codeigniter

查看:332
本文介绍了如何使用codeigniter将CSV导入mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个csv文件列表,我想导入到mysql db,使用codeigniter。



我试过 $ this- > load-> library('getcsv'); 库,但如何导入csv,而无需将CSV文件上传到服务器,我的意思是只是将文件上传到临时位置,

>

我想要这样的东西。



HTML: < input type =filename =csv/>



添加到临时字符串



代码: c> $ this-> input-> upload ['tmp_name']

解决方案

I给出了正确的答案。



这将生成CSV格式的报告。



Codeigniter中的报告



这将告诉你如何读取和转储csv文件。



Codeigniter REST CSV导入到mysql


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.

Reports in Codeigniter

And this will tell you how to read and dump csv files.

Codeigniter REST CSV import to mysql

这篇关于如何使用codeigniter将CSV导入mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆