1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

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

      新聞中心

      這里有您想知道的互聯(lián)網(wǎ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)建一個本質(zhì)為mht的文檔,該函數(shù)會分析文件內(nèi)容并從遠(yuǎn)程下載頁面中的圖片資源
      • 該函數(shù)依賴于類WordMake
      • 該函數(shù)會分析img標(biāo)簽,提取src的屬性值。但是,src的屬性值必須被引號包圍,否則不能提取
      • @param string $content HTML內(nèi)容
      • @param string $absolutePath 網(wǎng)頁的絕對路徑。如果HTML內(nèi)容里的圖片路徑為相對路徑,那么就需要填寫這個參數(shù),來讓該函數(shù)自動填補(bǔ)成絕對路徑。這個參數(shù)最后需要以/結(jié)束
      • @param bool $isEraseLink 是否去掉HTML內(nèi)容中的鏈接
        */
        // 手動下載下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();
      //這個算法要求src后的屬性值必須使用引號括起來
      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://')
      {
      //絕對鏈接,不加前綴
      }
      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";

      }


      本文名稱:PHPHTML生成word
      本文來源:http://ef60e0e.cn/article/pgodpg.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        久治县| 博罗县| 德钦县| 博乐市| 理塘县| 石泉县| 广河县| 洛南县| 广州市| 平和县| 九龙坡区| 宣恩县| 新丰县| 诸城市| 滁州市| 呈贡县| 藁城市| 名山县| 兴仁县| 中宁县| 榆林市| 江华| 阿图什市| 长岭县| 德令哈市| 公安县| 铅山县| 清涧县| 旌德县| 德格县| 车险| 乐陵市| 阳西县| 临西县| 台中市| 图们市| 长沙市| 铜山县| 伊金霍洛旗| 石台县| 家居|