开发者

Not Adding Contents to New Line while writing to a file in Append Mode

     <?php
    if(isset($_POST['submit'])){
    $file="get.php"开发者_运维问答;
    $open = fopen($file, "a+"); //open the file, (get.php).

    fwrite($open, "Name: " .$_POST['user'] . "/n"); //print / write the name.
    fwrite($open, "Colour: ". $_POST['color'] . "/n"); //print / write the colour.
    fclose($open); //close the opened file 

    echo "Log File Entry Had Been Made"; 
    }
     ?>

But The Output is written to get.php as -> /nName: The Name Posted/nColour: Colour Posted/n Please help if you have time, Thanks All.


The character is "\n", not "/n". Just replace that, it'll work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜