I have a text file in my system named "flow.txt". It is stores in my Documents folder. I want to write into this file using php. I have used following code to do this but no changes are observed in the file. It always show "Couldn't open $fp for writing!" .
$fp = fopen('~/Documents/flow.txt', 'a') or die("Couldn't open $fp for writing!");
fwrite($fp, print_r($arr, true));
fclose($fp);
And also tried file_put_contents() function. But, it too didn't work. Can anyone help?