Using PHP to generate Word documents, the resulting Word file can be opened with software such as Word,wps. The specific code is as follows:
function Word ($data, $fileName = "") {
if (empty ($data)) return "";
$data = "". $data. "";
if (empty ($fileName)) $fileName =date ("Ymdhis"). ". Doc ";
$FP =fopen ($fileName, "WB");
Fwrite ($fp, $data);
Fclose ($FP);
}
Examples are as follows:
$str = "
Create a Word document with PHP
Author: alixixi.com
If you open Word.doc and see the introduction here, the Word document was created successfully.
All rights reserved:
Www.Alixixi.com
";
Word ($STR);
:
http://www.bkjia.com/PHPjc/814687.html www.bkjia.com true http://www.bkjia.com/PHPjc/814687.html techarticle using PHP to generate Word documents, the resulting Word file can be opened with software such as Word,wps. The specific code is as follows: function word ($data, $fileName =) {if (empty ($data)) return; $data =. $data.; ...