01.
<html>
02.
<head>
03.
<title>ThaiCreate.Com PHP & writefile</title>
04.
</head>
05.
<body>
06.
<?php
07.
header(
'Content-Disposition: attachment; filename="test.txt"'
);
08.
readfile(
'test.txt'
);
09.
$objFopen
=
fopen
(
$strFileName
,
'w'
);
10.
$strText1
=
"I Love ThaiCreate.Com Line1\r\n"
;
11.
fwrite(
$objFopen
,
$strText1
);
12.
$strText2
=
"I Love ThaiCreate.Com Line2\r\n"
;
13.
fwrite(
$objFopen
,
$strText2
);
14.
$strText3
=
"I Love ThaiCreate.Com Line34 5 \r\n"
;
15.
fwrite(
$objFopen
,
$strText3
);
16.
17.
if
(
$objFopen
)
18.
{
19.
echo
"File writed."
;
20.
}
21.
else
22.
{
23.
echo
"File can not write"
;
24.
}
25.
26.
fclose(
$objFopen
);
27.
?>
28.
29.
</body>
30.
</html>