I have a script that generates a csv file using the following code:
header(\'Content-type: text/csv\'); header(\'Content-Disposition: attachment; filename=\"\'.d
I experienced the same issue. Later I replaced single quotes ' with double quotes " building $content variable.
'
"
i.e. Keeping outer quotes rather double than single in $content variable.
And it worked :)