当前位置:网站首页>php \n 换行无法输出
php \n 换行无法输出
2022-07-07 08:13:00 【zhang-php】
从接口拿到的json数组,数组中文字部分有换行,用json_decode转php数组后,输出在html页面竟然没有换行,一开始我以为是转数组后换行符号被删除了,后面用字符替换各种办法试了一遍,最后搜到了一个CSS样式:
white-space属性指定元素内的空白怎样处理,默认值normal(空白会被浏览器忽略)
属性值
| 值 | 描述 |
|---|---|
| normal | 默认。空白会被浏览器忽略。 |
| pre | 空白会被浏览器保留。其行为方式类似 HTML 中的 <pre> 标签。 |
| nowrap | 文本不会换行,文本会在在同一行上继续,直到遇到 <br> 标签为止。 |
| pre-wrap | 保留空白符序列,但是正常地进行换行。 |
| pre-line | 合并空白符序列,但是保留换行符。 |
| inherit | 规定应该从父元素继承 white-space 属性的值。 |
<td style="white-space:pre-wrap">{$vo.content}</td>加完这个属性之后就自动换行了

边栏推荐
- Postman interface test III
- 对存储过程进行加密和解密(SQL 2008/SQL 2012)
- The Himalaya web version will pop up after each pause. It is recommended to download the client solution
- Parameter sniffing (2/2)
- Review of the losers in the postgraduate entrance examination
- Or in SQL, what scenarios will lead to full table scanning
- 2022.7.6DAY598
- 搭建物联网硬件通信技术几种方案
- fiddler-AutoResponder
- Mongodb creates an implicit database as an exercise
猜你喜欢
随机推荐
学习记录——高精度加法和乘法
STM32 Basics - memory mapping
Vs code specifies the extension installation location
Remote meter reading, switching on and off operation command
Wallys/IPQ6010 (IPQ6018 FAMILY) EMBEDDED BOARD WITH ON-BOARD WIFI DUAL BAND DUAL CONCURRENT
单片机(MCU)最强科普(万字总结,值得收藏)
Embedded background - chip
根据设备信息进行页面跳转至移动端页面或者PC端页面
Chris Lattner, père de llvm: Pourquoi reconstruire le logiciel d'infrastructure ai
Appx代碼簽名指南
关于hzero-resource报错(groovy.lang.MissingPropertyException: No such property: weight for class)
2022.7.4DAY596
Win10 installation vs2015
IPv4 socket address structure
Postman interface test IV
虚数j的物理意义
Appx code signing Guide
STM32 product introduction
Several schemes of building hardware communication technology of Internet of things
Serial communication relay Modbus communication host computer debugging software tool project development case







![[sword finger offer] 42 Stack push in and pop-up sequence](/img/f4/eb69981163683c5b36f17992a87b3e.png)

