2
<?php



    $docName = "testdoc";


    header("Expires: Mon, 26 Jul 2020 05:00:00 GMT"); 
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache"); 

    header("Content-Type: application/msword; charset=ISO-8859-1");
    header("Content-Disposition: attachment; filename=\"".$docName.".doc"); 

    #/ Create and format your text using HTML, its simple stuff ... trial and error ;)
    echo '<img src="logo.gif" />';

?>

Soumya Sarkar

嗨,我从 google 获得了以下代码,以通过 php 生成 Doc 文件。但我无法在那里放置任何图像。有人可以帮我吗?

4

1 回答 1

0

它需要链接,您需要在线托管图像才能在文档中显示图像。

试试这个,它正在工作: -

echo "<img src='http://i.imgur.com/MJ5Sa.jpg' />";
于 2012-10-12T10:10:20.627 回答