2
$data
이라는 변수가있는 PHP 파일이 있습니다. 이제이 변수를 페이지에 표시합니다. 그것은 잘 작동하지만이 변수를 doc 파일에 쓰고 싶습니다. 어떻게 할 수 있니?PHP를 사용하여 doc 파일을 생성하는 방법
다음 방법을 사용하여 문서를 생성하지만 작동하지 않습니다. 그것의로
$fh = fopen('viewAppraisalDetailDoc.doc',"w+");
fwrite($fh, $data);
$file = 'viewAppraisalDetailDoc.doc';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/msword');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
아주 나쁜 생각,
는 PHP의 COM 설명서를 통해 이동, 나는 그것을 시도하지 않은대로, 일을하거나하지 여부를 확실하지 않다 창 전용 확장 프로그램. – Maerlyn일반적으로 모든 서버는 유닉스 또는 리눅스에 있습니다. 그럼 어떻게 유용합니까 ?? –