it is an example of fopen
<?php
$list = array (
array('aaa', 'bbb', 'ccc', 'dddd'),
array('123', '456', '789'),
array('"aaaa"', '"bbb"')
);
$fp = fopen('file.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>
it’s output is
aaa,bbb,ccc,dddd
123,456,789
"""aaaa""","""bbb"""
can any one say me why in “””aaaa”””,”””bbb””” why three quotation in place of one.
Because the strings you’re converting have quotes in them. Quotes are escaped in CSV files by doubling them, that is,
"abc"becomes""abc"". The third quotes are the “normal” CSV quotes that wrap strings.You don’t need to provide the quotes yourself for
fputcsv()so you can just usearray( 'aaa', 'bbb' ).