Write an array to a txt file
Moderator: General Moderators
Write an array to a txt file
Does anyone know how I can write an array to a text file? Basically I want to full post array to a text file. Thanks!
Re: Write an array to a txt file
Code: Select all
$myFile = "post.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = var_export($_POST);
fwrite($fh, $stringData);
fclose($fh);
echo $stringData;
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: Write an array to a txt file
try serialize() instead of var_export()