PHP write in file
I want to write something in a textfile.
$myFile = "meinung.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Floppy Jalopy\n";
fwrite($fh, $stringData);
$stringData = "Pointy Pinto\n";
fwr开发者_如何学JAVAite($fh, $stringData);
fclose($fh);
when i want to execute this, it says "cant open file"
what did i make wrong?
Place
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');
...
on top of your code to get error messages on screen or in your logfile (You know where your error logfile is, don't you?).
Set an absolute path to your file so that you really know in what directory the file is actually created to fix the filesystem permissions as noted in the comments.
精彩评论