开发者

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

开发者 https://www.devze.com 2023-04-06 09:08 出处:网络
<?php if(isset($_POST[\'submit\'])){ $file=\"get.php\"开发者_运维问答; $open = fopen($file, \"a+\"); //open the file, (get.php).
     <?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

精彩评论

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