<!doctype html>
<html>
<body>
<?php
echo "<h3>your order is processed !!!!</h3> <br>";
$akash = $_POST["tires"];
$akash2 = $_POST["Oil"];
$akash3 = $_POST["plugs"];
$akash4 = $_POST["hello"];
$write = "tires is ".$akash."<br>" ."Oil is " .$akash2."\t" ."Spark plug is " .$akash3."\t". "address is " .$akash4."<br>";
$open = fopen("order.txt","ab");
$write = fwrite($open,$write);
?>
</body>
</html>
答案 0 :(得分:1)
请尝试/r/n
而不是<br>
(它的html标记不适用于txt)
$write = "tires is ".$akash."\r\n" ."Oil is " .$akash2."\t" ."Spark plug is " .$akash3."\t". "address is " .$akash4."\r\n";
$open = fopen("order.txt","ab");
$write = fwrite($open,$write);
fclose($open);
在我的情况下输出是: -
tires is sdff
Oil is ddddd Spark plug is fffff address is ggggg
答案 1 :(得分:0)
你可能想放弃&#34; b&#34;在fopen声明中。 从manual开始,选项b是&#34;二进制&#34;这可能导致错误。