0
我在我的網站上實現了PHPWord以生成模板。 一切工作正常,但只有一個細節。當我的文件保存在我選擇的站點中時,副本將保存在我的php腳本所在的目錄中。PHPWord - 選擇保存位置
例如: 我點擊生成按鈕並選擇桌面來保存文件。好的 但是在我的php「generate.php」所在的目錄中保存了生成文件的副本。
--//I type the name of my file.
$nombrearchivo = 'MOP_Implementacion MW_'.$sitene.'_to_'.$sitefe.'_Raylex.docx';
保存我的文件
$templateWord->saveAs($nombrearchivo);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header('Content-type: application/vnd.openxmlformats officedocument.wordprocessingml.document');
header('Content-Disposition: attachment; filename="'.$nombrearchivo.'"');
header("Content-Transfer-Encoding: binary ");
echo file_get_contents($nombrearchivo);