Home>Article>Backend Development> How to remove double quotes when reading csv file in php

How to remove double quotes when reading csv file in php

尚
Original
2019-11-01 17:09:43 4180browse

How to remove double quotes when reading csv file in php

1. When writing a CSV file, you need to first determine whether there are commas and double quotes and handle them accordingly. The code is as follows

How to remove double quotes when reading csv file in php

2. Implement the method code for processing when reading a csv file

How to remove double quotes when reading csv file in phpAfter reading the csv file, use the str_replace() function to replace the double quotes in the file.

str_replace() function replaces some characters in a string with other characters (case sensitive).

Example:

The effect is as follows:

How to remove double quotes when reading csv file in php

##Recommendation:

php server

The above is the detailed content of How to remove double quotes when reading csv file in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn