pdf 中的动态文本
Dynamic text in 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.
您不能在 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 " .
($sex == "male" ? "Mr. " : "Ms. ") . $nume_student .
" who is a Computer-aided graphics student at our college.</p>";
$pdf->Write(0, $paragraph, '', 0, 'J', true, 0, false, false, 0);
这些是非常基本的语法问题。
我使用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.
您不能在 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 " .
($sex == "male" ? "Mr. " : "Ms. ") . $nume_student .
" who is a Computer-aided graphics student at our college.</p>";
$pdf->Write(0, $paragraph, '', 0, 'J', true, 0, false, false, 0);
这些是非常基本的语法问题。