php 生成word

<?php

$cout="input html";
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="http://www.w3.org/TR/REC-html40">';
}

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);
}
}
/*-------word class End-------*/
$word=new word;
$word->start();
echo $cout;
$wordname="em_info.doc";
$word->save($wordname);//保存word並且結束.
?>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章