最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
PHPHTML生成word

/**

你所需要的網(wǎng)站建設(shè)服務(wù),我們均能行業(yè)靠前的水平為你提供.標(biāo)準(zhǔn)是產(chǎn)品質(zhì)量的保證,主要從事成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、企業(yè)網(wǎng)站建設(shè)、手機(jī)網(wǎng)站制作、網(wǎng)頁設(shè)計(jì)、成都品牌網(wǎng)站建設(shè)、網(wǎng)頁制作、做網(wǎng)站、建網(wǎng)站。創(chuàng)新互聯(lián)擁有實(shí)力堅(jiān)強(qiáng)的技術(shù)研發(fā)團(tuán)隊(duì)及素養(yǎng)的視覺設(shè)計(jì)專才。

  • 根據(jù)HTML代碼獲取word文檔內(nèi)容
  • 創(chuàng)建一個(gè)本質(zhì)為mht的文檔,該函數(shù)會(huì)分析文件內(nèi)容并從遠(yuǎn)程下載頁面中的圖片資源
  • 該函數(shù)依賴于類WordMake
  • 該函數(shù)會(huì)分析img標(biāo)簽,提取src的屬性值。但是,src的屬性值必須被引號(hào)包圍,否則不能提取
  • @param string $content HTML內(nèi)容
  • @param string $absolutePath 網(wǎng)頁的絕對(duì)路徑。如果HTML內(nèi)容里的圖片路徑為相對(duì)路徑,那么就需要填寫這個(gè)參數(shù),來讓該函數(shù)自動(dòng)填補(bǔ)成絕對(duì)路徑。這個(gè)參數(shù)最后需要以/結(jié)束
  • @param bool $isEraseLink 是否去掉HTML內(nèi)容中的鏈接
    */
    // 手動(dòng)下載下Wordmaker

function WordMake( $content , $absolutePath = "" , $isEraseLink = true )
{
import("ORG.Util.Wordmaker");
$mht = new \MhtFileMaker();
if ($isEraseLink){
$content = preg_replace('/.?\s>(\s.?\s)<\/a>/i' , '$1' , $content); //去掉鏈接
}
$images = array();
$files = array();
$matches = array();
//這個(gè)算法要求src后的屬性值必須使用引號(hào)括起來
if ( preg_match_all('/?src\s?=\s?[\"\'](.?)\"\'\/>/i',$content ,$matches ) ){
$arrPath = $matches[1];
for ( $i=0;$i{
$path = $arrPath[$i];
$imgPath = trim( $path );
if ( $imgPath != "" )
{
$files[] = $imgPath;
if( substr($imgPath,0,7) == 'http://')
{
//絕對(duì)鏈接,不加前綴
}
else
{
$imgPath = $absolutePath.$imgPath;
}
$images[] = $imgPath;
}
}
}
$mht->AddContents("tmp.html",$mht->GetMimeType("tmp.html"),$content);
for ( $i=0;$i{
$image = $images[$i];
if ( @fopen($image , 'r') )
{
$imgcontent = @file_get_contents( $image );
if ( $content )
$mht->AddContents($files[$i],$mht->GetMimeType($image),$imgcontent);
}
else
{
echo "file:".$image." not exist!
";
}
}
return $mht->GetFile();
}

function GenerateWord($content){
$_path='Uploads/word/'.date('Y-m-d',time()).'/';
if (!file_exists($_path)){ mkdir ($_path); }
$content = iconv("utf-8", "GBK",$content);
$rand=rand(1000,9999);

$fileContent = WordMake($content,$url);//生成word內(nèi)容

$fp = fopen($_path.$name.time().$rand.".doc", 'w');//打開生成的文檔
fwrite($fp, $fileContent);//寫入包保存文件
fclose($fp);
return $_path.$name.time().$rand.".doc";

}


網(wǎng)站題目:PHPHTML生成word
鏈接分享:http://fisionsoft.com.cn/article/pgodpg.html