$qwerty="hello" $text1=($qwerty); $text2="james"; fputs($file, $text); fputs($file, $text2); fclose($file);
The output is hellojames How to make it: (print at new line ) hello james
Thanks. I am a newbie. 🙂
$qwerty="hello\n" <== try this. add a \n which means next line $text1=($qwerty); $text2="james"; fputs($file, $text); fputs($file, $text2); fclose($file);
$qwerty="hello" $text1=($qwerty); $text2="james"; fputs($file, $text\n); <==accually it might work better here fputs($file, $text2); fclose($file);
Tried what you suggested but there was an error: Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /www/htdocs/main/testmenu1.php on line 18
I put the \n at -> fputs($file, $text\n); Any ideas?
I used fwrite and it was OK
$filename = "test.txt"; header("Content-type: text/plain"); header("Content-Disposition: attachment; filename=$filename"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public"); $content = "+Line 1 : ..." . "\n"; $content .= "+Line 2 : ..." . "\n"; echo $content;
$filename = "test.txt"; header("Content-type: text/plain"); header("Content-Disposition: attachment; filename=$filename"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public");
$content = "+Line 1 : ..." . "\n"; $content .= "+Line 2 : ..." . "\n";
echo $content;
The code above use header to export txt file to browser. But the line break ('\n') DOESNOT work. Anybody know why. Please show me. Any advices are much appriciated.
Best Regrad,