Home>
The value received from the form is written to the txt file, but it is written as it is without a line break. How can I make a line break?
ID = 1, product = chair, color = mredID = 2, product = chair, color = green
ID = 1, product = chair, color = red
ID = 2, product = chair, color = green
I want to do this.
I tried to insert a line feed code, but I couldn't.
$json = file_get_contents ("php: // input");
$json_data = json_decode ($json, true);
$ID = $json_data ['id'];
$product = $json_data ['product'];
$color = $json_data ['color'];
$str = "ID = {$ID}, product = {$product}, color = {$color}";
$fp = fopen ("send.txt", "a");
fwrite ($fp, $str);
explode ("\ n", $fp);
fclose ($fp);
-
Answer # 1
-
Answer # 2
Write a newline code after writing
Related articles
- php - i want to be able to view messages written by other people even if i am not logged in
- php - i want to cron wordpress every hour, but i want to shift multiple processes
- php - [jquery] i want to add a parent element for every three posts that are looping
- python - how to break every 5 lines in the list
- php - [mysql] number of times the subquery written in the select part is executed when count (*) is acquired
- php - i want to execute the process many times every time the button is pressed in javascript
- i want to change the color of the ball every time i break one block with python breakout
- php - i want to display the sql execution result written in the controller in the view
- read a text file as an array with php, break each line and display it on the browser (loop processing)
- php - is there a new definition of a common definition every time?
- postgresql restore nothing written when executing external command in php
Trends