내 머리글에 어떤 문제가 있는지 말해 줄 수 있습니까? 내 다운로드가 효과적이지 않습니다. 나는 PHPWord 라이브러리를 사용하지만 난 그게단어 파일을 다운로드 할 수 없습니다.
<?php
require_once 'PHPWord.php';
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$wordText = utf8_encode($_REQUEST['TEXT']);
$section->addText($wordText);
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
//$objWriter->save('helloWorld.docx');
$path = 'tmp/kikou2.docx';
$objWriter->save($path);
//download code
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' .$path);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Content-Length: ' . filesize($objWriter));
readfile($objWriter);
unlink($objWriter); // deletes the temporary file
exit;
?>
감사
그것은 작동하지 않습니다 (그리고 다른 답변도 너무 ..), 당신은 어떤 생각을 가지고 있습니까? – So4ne
내 잘못 파일을 호출하도록 허용 할 수없는 POST 아약스 요청을 사용합니다. 하지만 당신의 대답은 좋았고 도움이되었습니다, 감사합니다! – So4ne