简体   繁体   中英

Load and read a csv file with php

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?

Yes, it can open directly using fopen and fgetcsv

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM