Home  >  Article  >  Backend Development  >  The simplest example of php generating word

The simplest example of php generating word

WBOY
WBOYOriginal
2016-07-25 09:04:011337browse
  1. class word
  2. {
  3. function start()
  4. {
  5. ob_start();
  6. print' xmlns:w="urn:schemas-microsoft-com:office:word"
  7. xmlns="http://www.w3.org/TR/REC-html40">';
  8. }
  9. function save($path)
  10. {
  11. print "";
  12. $data = ob_get_contents();
  13. ob_end_clean();
  14. $this->wirtefile ($path,$data);
  15. }
  16. function wirtefile ($fn,$ data)
  17. {
  18. $fp=fopen($fn,"wb");
  19. fwrite($fp,$data);
  20. fclose($fp);
  21. }
  22. }
  23. ?>
Copy code
Editor’s recommendation: Example code for php exporting word format documents The easiest way to generate excel or word documents with php php generates word document (read database) Example of php using phpword to generate word document Simple example of generating word file with php php generates code to export word (can include pictures) Example of php generating word php uses phpword to generate word documents


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn