小编hec*_*iov的帖子

将纯文本格式化为HTML标记

我正在使用cakephp作为我的Web应用程序.我有一个数据库表,我存储了一些以纯文本保存的文字.我能做什么,我可以得到它自己格式化的文本我html标记?

例如,我在数据库上有一个文本,如:

blablablabalbalblablablablablablablablabalbalbla.
otherotherotherotherotherother.
helloworldhelloworldhelloworldhelloworld.
Run Code Online (Sandbox Code Playgroud)

但是,当我得到它时,它显示如下:

blablablabalbalblablablablablablablablabalbalbla.otherotherotherotherotherother.helloworldhelloworldhelloworldhelloworld.
Run Code Online (Sandbox Code Playgroud)

但是我希望它像这样进入html:

<p>blablablabalbalblablablablablablablablabalbalbla.</p>
<p>otherotherotherotherotherother.</p>
<p>helloworldhelloworldhelloworldhelloworld.</p>
Run Code Online (Sandbox Code Playgroud)

无论如何要做到这一点?

html php format cakephp

-1
推荐指数
1
解决办法
3636
查看次数

标签 统计

cakephp ×1

format ×1

html ×1

php ×1