从mysql数据库中提取数据时如何在mpdf中放置换行符 [英] How to put line break in mpdf when data is extracted from mysql database

查看:174
本文介绍了从mysql数据库中提取数据时如何在mpdf中放置换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MPDF从mysql数据库中存储的数据生成pdf文件.尽管我可以按预期提取和显示其他数据,但是由于它们全部都位于单行中,所以我无法显示多行文本.有人可以帮我解决这个问题.

I am using MPDF to generate pdf files from data stored in mysql database. Though I could extract and display others data as expected, I could not display multiline text as they all comes in single line. Could someone help me to resolve this problem.

EG.我来自textarea的数据在数据库中显示为: 一个

EG. My data from textarea is shown in database as: One

两个

三个

但是在pdf中,它将被生成为OneTwoThree

But in pdf it will ge generated as OneTwoThree

当我使用phpmyadmin检入数据库时​​,其存储的数据为One \ r \ nTwo \ r \ nThree

When I check in database using phpmyadmin its stored data as One\r\nTwo\r\nThree

请帮助.

推荐答案

尝试使用此代码. $ finalString = nl2br($ htmlOut);

Try with this code. $finalString = nl2br($htmlOut);

这篇关于从mysql数据库中提取数据时如何在mpdf中放置换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆