当前位置:网站首页>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>加完这个属性之后就自动换行了

边栏推荐
- STM32 ADC和DMA
- Web3.0 series distributed storage IPFs
- Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
- 单片机(MCU)最强科普(万字总结,值得收藏)
- 【剑指Offer】42. 栈的压入、弹出序列
- 嵌入式工程师如何提高工作效率
- Leetcode exercise - 113 Path sum II
- IO模型复习
- 学习记录——高精度加法和乘法
- Bit operation ==c language 2
猜你喜欢

Postman interface test V

ORM -- grouping query, aggregation query, query set queryset object properties

【HigherHRNet】 HigherHRNet 详解之 HigherHRNet的热图回归代码

对存储过程进行加密和解密(SQL 2008/SQL 2012)

ORM -- logical relation and & or; Sort operation, update record operation, delete record operation

The story of Plato and his three disciples: how to find happiness? How to find the ideal partner?

【acwing】789. 数的范围(二分基础)

Methods of adding centerlines and centerlines in SolidWorks drawings

Wallys/IPQ6010 (IPQ6018 FAMILY) EMBEDDED BOARD WITH ON-BOARD WIFI DUAL BAND DUAL CONCURRENT

SQLyog数据库怎么取消自动保存更改
随机推荐
Inno setup packaging and signing Guide
大整数类实现阶乘
Leetcode exercise - 113 Path sum II
Bean operation domain and life cycle
Can I open a stock trading account online? Is it safe
Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
0x0fa23729 (vcruntime140d.dll) (in classes and objects - encapsulation.Exe) exception thrown (resolved)
基于gis三维可视化技术的智慧城市建设
XML configuration file parsing and modeling
Vs code specifies the extension installation location
Appx代码签名指南
Postman interface test I
Deconvolution popular detailed analysis and nn Convtranspose2d important parameter interpretation
浅谈日志中的返回格式封装格式处理,异常处理
ES类和对象、原型
XML配置文件解析与建模
高数_第1章空间解析几何与向量代数_向量的数量积
Appx code signing Guide
Kotlin实现微信界面切换(Fragment练习)
ES6中的原型对象