Wednesday 15 August 2012

html - PHP not outputting new lines from JSON data -


I am getting a feed that contains JSN data which was then decoded by php (json_decode) and my html Page.

Feeds have \ n characters, but when PHP takes them out, the HTML does not recognize them as a new line or line break, so the HTML text one As the big wall of text comes out

Does anyone give me an indication that PHP has made one or the same thing when JSN data is in \ n , So what should I do?

As an example, in JSN data "Friday through Wednesday." It is possible. \ N \ n there is more rain "But when HTML is generated then it looks" on Wednesday through Wednesday. "There is more rain" same line

Thank you!

You have to replace it with '\ n' equals html, which is BR tag.

You can output your string as follows:

  echo str_replace ("\ n", "


No comments:

Post a Comment