2012-08-10 53 views
0

我想弄清楚如何在不創建物理TXT文件來打印數據的情況下打印出動態內容。FPDF:從另一個PHP回顯文本

換句話說,我打電話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..."

什麼是打印動態內容的最佳方式?

回答

0

我通常會做的是從生成PDF的腳本中組裝動態內容(使用post變量查詢數據庫...)。

如果這不是必需的,並且您要調用的php腳本輸出純文本,則可以使用輸出緩衝。

有一個問題,這裏已經被問到答案: Read echo'ed output from another php file。所以基本上,你把輸出放在一個變量中,並使用FPDF Write,Cell或Multicell-function,把它放在你的pdf中。

+0

是的,我認爲這也是走的路!謝謝! – dcolumbus 2012-08-10 22:14:55