Reputation: 417
I just tried to use this file_put_contents
.
The code is:
$file = 'list.txt';
$subject = "Mail Subject\n";
file_put_contents($file, $subject);
But it doesn’t put any contents. file_get_contents
is working though.
Update: Problem solved. I’m not sure. I just changed chmod to 777. But I have a doubt. I am checking the log error.
Upvotes: 0
Views: 2550
Reputation: 5918
Things to check:
file_put_contents
returns the number of bytes written or false on error. Save the return value to a variable and see what you get back.Upvotes: 1