I have a delimited string coming from a service, I want to convert this delimited string with headers to a downlodable CSV file.
    empId,empName,salary,depName,depId
    1,John,20000,IT,2
Could someone help me with a code snippet/reference.
I have a delimited string coming from a service, I want to convert this delimited string with headers to a downlodable CSV file.
    empId,empName,salary,depName,depId
    1,John,20000,IT,2
Could someone help me with a code snippet/reference.
 
    
    change header first
<?php
    header('Content-Disposition: attachment; filename="downloaded.csv"');
    echo 'empId,empName,salary,depName,depId';
    echo '1,John,20000,IT,2';   
?>
and then echo your output.
