MimmiNor Posted June 27, 2019 Share Posted June 27, 2019 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 More sharing options...
justsomeguy Posted June 28, 2019 Share Posted June 28, 2019 It doesn't send the file to the browser, it just saves it in the same directory as that PHP file. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now