是否可以在PHP中读写Word(doc / docx)文件并将内容附加到一个doc / docx文件中?
我可以在txt文件中做到这一点。但是无法确定doc / docx文件。
<?php
error_reporting(0);
//Name of the directory containing all files to merge
$Dir = "dir";
//Name of the output file
$OutputFile = "output.txt";
//Scan the files in the directory into an array
$Files = scandir ($Dir);
//Create a stream to the output file
$Open = fopen ($OutputFile, "w"); //Use "w" to start a new output file from zero. If you want to increment an existing file, use "a".
//Loop through the files, read their content into a string variable and write it to the file stream. Then, clean the variable.
foreach ($Files as $k => $v) {
if ($v != "." AND $v != "..") {
$Data = file_get_contents ($Dir."/".$v);
fwrite ($Open, $Data);
}
unset ($Data);
}
//Close the file stream
fclose ($Open);
?>
谁能帮助我阅读多个doc / docx文件的内容并将其放入一个doc / docx中?