My value in array and i want to prient each value in in seprat开发者_如何学运维es line
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Bobby Bopper\n";
fwrite($fh, $stringData);
$stringData = "Tracy Tanner\n";
fwrite($fh, $stringData);
fclose($fh);
http://www.tizag.com/phpT/filewrite.php
Please google next time...
Use "\n"
instead of '\n'
. Single quotes interpret less special characters than double quotes.
On Windows, use "\r\n"
instead of "\n"
, because line endings in Windows are different than in Unix.
If you have the luxury of php5:
file_put_contents($filename, "My name is Alok Ranjan Dubey.\n");
精彩评论