我正在尝试根据PHPWord 示例的示例示例生成一个单词模板。但是没有生成word模板或无法成功显示页面。我已经过滤掉了示例代码,只添加了一段hello world!
Code:
<?php
require_once 'PHPWord.php';
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$section->addText('Hello world!');
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=helloWorld.docx");
header("Content-Type: application/docx");
header("Content-Transfer-Encoding: binary");
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('helloWorld.docx');
?>
请建议,如果我使用 objwriter-> 保存 helloworld.docx。它会自动在我的网络服务器中吗?还是临时文件夹?
谢谢!