Jump to content

PHP 7 fputcsv() Function not creating file


MimmiNor

Recommended Posts

I'm trying to understand fputcsv, but I can not

I've pasted the code here: https://www.w3schools.com/php7/func_filesystem_fputcsv.asp

into a file an uploaded it here: https://askerspeiderne.no/lastned.php

But nothing happens when I reload the page. I thought it would create and download a CSV.

What is wrong? The code, the browser, the server?

fputcsv
 <?php
$list = array (
  array("Peter", "Griffin" ,"Oslo", "Norway"),
  array("Glenn", "Quagmire", "Oslo", "Norway")
);

$file = fopen("contacts.csv","w");

foreach ($list as $line) {
  fputcsv($file, $line);
}

fclose($file);
?> 

Please help me!

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...