how to use php to include an image in a word file?
问题 Somebody has asked me to make an app in php that will generate a .doc file with an image and a few tables in it. My first approach was: <?php function data_uri($file, $mime) { $contents = file_get_contents($file); $base64 = base64_encode($contents); return ('data:' . $mime . ';base64,' . $base64); } $file = 'new.doc'; $fh = fopen($file,'w'); $uri = data_uri('pic.png','image/png'); fwrite($fh,'<table border="1"><tr><td><b>something</b></td><td>something else</td></tr><tr><td></td><td></td></tr