使用php加载并读取csv文件 [英] Load and read a csv file with php

查看:401
本文介绍了使用php加载并读取csv文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以csv格式下载一些内容。它在线存储在csv文件中。我不能只读内容。我首先要下载文件,打开然后阅读它。

I want to download some content in csv format. It is stored online in a csv file. I can not just read the content. I first have to download the file, open and then read it.

有没有办法直接打开它?或者,我必须先在我的服务器上加载/上传,然后像传统文件一样打开它吗?

Is there a way to open it directly? Or do I have to first load/upload it on my server and then open it like a classic file?

推荐答案

可以使用 fopen fgetcsv

此功能有时限于安全问题,您可以通过文档读取
的详细信息

However, this feature sometime is restricted for security concern, and you can read the details via the documentation

  • http://php.net/manual/en/function.fopen.php
  • http://php.net/manual/en/function.fgetcsv.php

直接打开的另一个缺点,如果页面被处理很多次,这意味着它会产生大量的网络传输开销,可能会减慢您的页面生成时间。

Another drawback of open directly, if the page is processed many time, which mean it generate lots of network transfer overhead, and potentially slow down your page generation time.

理想情况下载到您的服务器,并重复使用本地磁盘文件进行处理,这将节省一些网络带宽。

Ideal case will be download into your server, and repeated use local disk file for processing, that will save some network bandwidth.

这篇关于使用php加载并读取csv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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