You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

word.php 711 B

3 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: admin
  5. * Date: 2016/11/8
  6. * Time: 16:16
  7. */
  8. //word 导出类
  9. class word
  10. {
  11. function start()
  12. {
  13. ob_start();
  14. echo '<html xmlns:o="urn:schemas-microsoft-com:office:office"
  15. xmlns:w="urn:schemas-microsoft-com:office:word"
  16. xmlns="http://www.w3.org/TR/REC-html40">';
  17. }
  18. function save($path)
  19. {
  20. echo "</html>";
  21. $data = ob_get_contents();
  22. // var_dump($data);exit();
  23. // ob_end_clean();
  24. $this->wirtefile ($path,$data);
  25. // ob_end_clean();
  26. }
  27. function wirtefile ($fn,$data)
  28. {
  29. $fp=@fopen($fn,"wb",0777);
  30. @fwrite($fp,$data,0777);
  31. @fclose($fp);
  32. }
  33. }