First release of domframework
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1207 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
22
outputcsv.php
Normal file
22
outputcsv.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
require_once ("output.php");
|
||||
class outputcsv extends output
|
||||
{
|
||||
public function out ($data)
|
||||
{
|
||||
if (!function_exists ("fputcsv"))
|
||||
throw new Exception ("CSV support not available in PHP !", 500);
|
||||
if (!is_array ($data))
|
||||
$data = array ($data);
|
||||
@header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
@header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||
@header('Last-Modified: '.gmdate ('D, d M Y H:i:s').' GMT');
|
||||
@header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
@header('Pragma: no-cache');
|
||||
@header ("Content-Type: text/csv");
|
||||
// TODO : return $csv
|
||||
$out = fopen ('php://output', 'w');
|
||||
fputcsv ($out, $data);
|
||||
fclose ($out);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user