Wrap CSV values generated by PHP fputcsv() with “ ”

后端 未结 5 1223
忘了有多久
忘了有多久 2020-12-19 01:41

So, my code generates a CSV file using PHP\'s built-in fputcsv function.

For the delimiter, I use \',\' (a comma).
For the enclosure, I use \'

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-19 02:42

    Any reason you can't str_replace(',,',',"",',$output); ? You'd also have to see if the last or first character is a comma and if so, replace the comma with ,""

提交回复
热议问题