问题描述
我正在使用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中放置换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!