pdf中的动态文本

我使用 pdf 并遇到以下问题:当我写文本时一切正常,但是当我想写一个动态文本时,比如“Hello X”,其中 X 是从数据库中获取的,它不起作用。我的意思是,我没有显示数据库中的名称。


我使用下面的代码编写它:


$ pdf-> Write (0, 'Faculty of Aerospace', '', 0, 'L', true, 0, false, false, 0);

$ paragraph. = '

<P>

I am writing this letter in support of <? Php if ($ sex == "male"):?> Mr. <? Php else:?> Ms. <? php endif?> <? php echo $ nume_student;?>, who is a Computer-aided graphics student at our college. </p> ';

$ pdf-> Write (0, $ paragraph, '', 0, 'J', true, 0, false, false, 0);

我想出现我写这封信是为了支持先生......但实际出现


我写这封信是为了支持 <? Php if ($ sex == "male"):?> Mr.


狐的传说
浏览 136回答 1
1回答

互换的青春

您不能<?php .... ?>在 PHP 字符串中使用。$pdf->Write(0, 'Faculty of Aerospace', '', 0, 'L', true, 0, false, false, 0);$paragraph = "<p>I am writing this letter in support of " .&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;($sex == "male" ? "Mr. " : "Ms. ") . $nume_student .&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;" who is a Computer-aided graphics student at our college.</p>";$pdf->Write(0, $paragraph, '', 0, 'J', true, 0, false, false, 0);这些是非常基本的语法问题。
打开App,查看更多内容
随时随地看视频慕课网APP