Hướng dẫn php parse csv line
Ngày đăng:
29/09/2022
Trả lời:
0
Lượt xem:
100
I have been seeking the same thing without using some unsupported PHP class. Excel CSV doesn't always use the quote separators and escapes the quotes using "" because the algorithm was probably made back in the '80s or something. After looking at several .csv parsers in the comments section on PHP.NET, I have seen ones that even used callbacks or eval'd code and they either didn't work like needed or simply didn't work at all. So, I wrote my own routines for this and they work in the most basic PHP configuration. The array keys can either be numeric or named as the fields given in the header row. Hope this helps.
...bob can now go back to his speadsheets |