php生成word最簡單的.例子,所謂簡單即是美,小東東大用途,有用到的朋友參考下吧。就跟隨小編去了解下吧,想了解更多相關資訊請 持續關注我們應屆畢業生考試網!
程式碼示例:
<?php
class word
{
function start()
{
ob_start();
print'<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="">';
}
function save($path)
{
print "</html>";
$data = ob_get_contents();
ob_end_clean();
$this->wirtefile ($path,$data);
}
function wirtefile ($fn,$data)
{
$fp=fopen($fn,"wb");
fwrite($fp,$data);
fclose($fp);
}
}
?>