现在,我一切都很好。它根据我的CSS打印(text-align:center;) 我唯一的问题是图像。这是HTML代码:
<table id="cert">
<td>
<tr><h1>Singapore Aviation Academy</h1></tr>
<tr><img src = "img/logo1.jpg" /></tr>
<tr><h2>Certificate of Completion </h2></tr>
<tr>is hereby granted to</tr>
<tr><?php echo "<b>".$row['fname']." ".$row['lname']."</b>"; ?> </tr>
<tr>to certify that he/she has completed to satisfaction for</tr>
<tr><?php echo "<b>".$row1['course_title']."</b>"; ?></tr>
</td>
</table>
之后:
<?php
//This php will enable documents to be embedded with Microsoft Word
header("Content-type: application/msword"); //Document will be embedded using the application, Microsoft Word
header("Content-disposition: attachment; filename= \"Certificate for ".$row['fname']." ".$row['lname']."\""); //States the file name when opened to edit or view
?>
问题在于<img>
标记。如果没有最后一行PHP代码,则会显示图像。有了它,图像就不会显示在MS-Word中。
知道如何解决这个问题吗?
答案 0 :(得分:1)
在Word中打开时不会显示图像,因为word在客户端的桌面上运行并在本地查找图像...除非您为图像文件指定完整的URL,否则它不知道在您的服务器
选项: