简体   繁体   English

从数据库中检索数据时换行

[英]Line break while retrieving data from database

I have a form that contains a textarea.我有一个包含文本区域的表单。 And the contents stored in a database.并将内容存储在数据库中。 And there is a page (using php echo ) to display the content.并且有一个页面(使用php echo )来显示内容。 If somebody typed the content without space, the layout is going wrong.如果有人在没有空格的情况下键入内容,则布局出错。

For example:例如:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊

I need anything that automatically inserts a line break.我需要任何自动插入换行符的东西。

Look at built in function wordwrap看看内置 function wordwrap

Wraps a string to a given number of characters using a string break character.使用字符串分隔符将字符串包装为给定数量的字符。

One idea is to set overflow: scroll in css for that div.一个想法是设置overflow: scroll该 div。

you can use word-wrap: break-word;你可以使用word-wrap: break-word; CSS property when displaying it, but it is a CSS3 property ie it works on Google Chrome, FireFox4, Opera 10, IE9 ONLY.显示时 CSS 属性,但它是 CSS3 属性,即它仅适用于 Google Chrome、FireFox4、Opera 10、IE9。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM