猿问

php利用header函数生成word,内容有,但是就是没有图片,求解。有没有好的php类可以生成word,除了phpword

function makeWord($content){

$filename = date('YmdHis');
extract($content);
foreach ($pic as $key => $value) {
    if($value){ 
        $key = '123<img src="https://172.16.59.56:28443/app/helpers/tcpdf/examples/images/{$key}.png">';
}
header('pragma:public'); 
header('Content-type:application/vnd.ms-word;charset=utf-8;name="'.$filename.'".doc');
header("Content-Disposition:attachment;filename=$filename.doc"); 
$html = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>';
echo $html.$key.'</html>';
}

}
是我图片地址不对么,但是我的链接地址是可以打开的,我测试了。word里面只有123,图片显示错误

烙印99
浏览 469回答 2
2回答
随时随地看视频慕课网APP
我要回答