java - 解析json数据如何自动换行
伊谢尔伦
伊谢尔伦 2017-04-17 17:38:58
0
9
1285

中间的一大段我应该怎么让他分成几行呢?返回的是json数据,是要讲,替换成什么特殊字符么??

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(9)
伊谢尔伦

I obtained the string .replace("The escape character you set yourself or specified for newline", "nt");

迷茫
\r
刘奇

json is just data, the front-end display is controlled by you
html automatic line wrapping just needs to be surrounded by p!

迷茫

This part really needs to be handled by yourself, unless the json data returned by the backend provides you with a list of the fields you need, which is very convenient to control.

洪涛

Multiply the width of each Chinese character by the number, and add a line break when it is larger than the screen width. The width of Chinese characters can be calculated based on the value of the textsize attribute.

洪涛

The json format does not have line breaks. The string enclosed by "" needs to be replaced with a line break escape character. When a general json tool converts a string to json, it will automatically convert the line break character into an escaped line break character, such as line feed and carriage return. The 2 special characters 0x0d 0x0a are automatically converted into the 4-character escape character rn. Generally, manual conversion is not required

黄舟

This is the escape agreed by the server and client, such as the agreed line break---"&br". . .

阿神

What you screenshot is equivalent to a string of HTML strings. Just escape special characters such as quotation marks and tabs and store it as data in JSON format. . Then when you want to use it, just get this string of data from JSON and output it in an HTML file.

伊谢尔伦

Your json data format problem, please communicate with the backend about this aspect

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template