简体   繁体   中英

Any way to open CSV file with PHP and replace certain text?

As the title says, I am trying to open a CSV file that is comma delimited and I need to update specific part of the CSV string. Is that possible? I have looked into fseek but that only let's me count the number of bytes from the BOF so that won't work as each CSV would be different.

I was thinking if it was possible if I set the specific part I want to change with something like "CHANGEME" and have PHP look for that string/character and replace that with whatever I need.

Possible?

Try fgetcsv (documentation ) or str_getcsv .

Maybe these functions will help.

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