0

我试图弄清楚如何在不创建物理 TXT 文件来打印数据的情况下打印出动态内容。

换句话说,我正在调用mytext.php并写出内容......mytext.php看起来像这样:

<?php echo "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";

并且PDF是在文本中生成的所有内容......所以<?php echo "Lorem..."

打印动态内容的最佳方式是什么?

4

1 回答 1

0

我通常做的是从生成pdf的脚本中组装动态内容(查询数据库,使用后变量......)。

如果这不是必需的并且您调用的 php 脚本输出纯文本,则可以使用输出缓冲。

这里有一个问题已经被问到了答案: Read echo'ed output from another php file

所以基本上,你把输出放在一个变量中,然后使用 FPDF Write、Cell 或 Multicell 函数,把它放在你的 pdf 中。

于 2012-08-10T21:32:00.367 回答