Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- function writecsv(){
- $list = array (
- array('aaa', 'bbb', 'ccc', 'dddd'),
- array('123', '456', '789'),
- array('"aaa"', '"bbb"')
- );
- $file = fopen('file.csv', 'w');
- var_dump($file);
- foreach ($list as $fields) {
- fputcsv($file, $fields, ";");
- }
- fclose($file);
- }
- if (isset($_GET['file'])) {
- header('Content-Disposition: attachment; filename="abc.csv"');
- readfile('file.csv');
- } else {
- echo "Funkcja zapisuje tablice do pliku file.csv na serwerze.\n Plik ma taka zawartosc jak trzeba.\n";
- echo "<a href=\"?file=1\">Link</a>";
- writecsv();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement