ð Cele mai noi postari
â
- Stefanescu Mihai a postat in Paginare in PHP
- johhny a postat in Paginare in PHP
- Stefanescu Mihai a postat in Cum pot afisa eroarea cand utilizatorul a scris un username gresit sau o parola gresita?
- madalin a postat in Cum pot afisa eroarea cand utilizatorul a scris un username gresit sau o parola gresita?
- Stefanescu Mihai a postat in Featureuri site
Generare CSV din array
function generateCsv($data, $delimiter = ',', $enclosure = '"') {
$handle = fopen('php://temp', 'r+');
foreach ($data as $line) {
fputcsv($handle, $line, $delimiter, $enclosure);
}
rewind($handle);
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($handle);
return $contents;
}
Si asa il putem folosi
$data = array(
array(1, 2, 4),
array('test string', 'test, literal, comma', 'test literal "quotes"'),
);
echo generateCsv($data);
ð Bookmarks
â
âĻ Pentru a sustine aceasta comunitate am sa te rog sa te autentifici sau sa te inregistrezi!
ðŠïļ Discord
â