<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                <?php //基于windows系統下和linux系統下的在線預覽word文檔功能 //----------------------------------------------------windows系統下start------------------------------------------- //控制器: //獲取文件路徑 $file = substr(thumb($extends['file']),1); if(!is_file($file)){ $this->error("文件不存在!"); }else{ //獲取文件類型 $file_type = strtolower(substr($file,strrpos($file,".")+1)); switch ($file_type){ case 'doc': case 'docx': $name = "show_word_".$id.".html"; $view_path = "Uploads/View_file/".$name; if(file_exists($view_path)){ $content = file_get_contents($view_path); echo $content; }else{ view_word($file,$name); } break; } } //view_word方法 //預覽word文件 function view_word($wordname,$htmlname){ //建立一個指向新COM組件的索引 $word = new COM("word.application") or die("Unable to instanciate Word"); //顯示目前正在使用的Word的版本號 //echo "Loading Word, v. {$word->Version}"; //把它的可見性設置為0(假),如果要使它在最前端打開,使用1(真) $word->Visible = 1; //讀取Word內容操作 START //打開一個word文檔 $word->Documents->Open(realpath($wordname)); //定義一個目錄來存放生成的html文件,不存在則創建 $path = WEB_ROOT."Uploads/View_file/"; if (!file_exists($path)){ mkdir($path); } //將filename.doc轉換為html格式,并保存為html文件 $word->Documents[1]->SaveAs($path.$htmlname,8); //獲取htm文件內容并輸出到頁面 (文本的樣式不會丟失) $content = file_get_contents($path.$htmlname); echo $content; //獲取word文檔內容并輸出到頁面(文本的原樣式已丟失) // $content= $word->ActiveDocument->content->Text; // echo $content; //關閉與COM組件之間的連接 $word->Documents->close(true); $word->Quit(); $word = null; unset($word); } //----------------------------------------------------windows系統下end---------------------------------------------- //----------------------------------------------------linux系統下start------------------------------------------- 首先要在命令行中輸入下面內容并執行 wget http://www.winfield.demon.nl/linux/antiword-0.37.tar.gz tar zxvf antiword-0.37.tar.gz cd antiword-0.37 make make install make global_install cp /root/bin/*antiword /usr/local/bin/ mkdir /usr/share/antiword cp -R /root/.antiword/* /usr/share/antiword/ chmod 777 /usr/local/bin/*antiword chmod 755 /usr/share/antiword/* //控制器內容:*/ header("Content-type: text/html; charset=utf-8"); $content = shell_exec('/usr/local/bin/antiword -w 0 -m UTF-8 '.$file); echo '<pre>'; print_r ($content); echo '</pre>'; //----------------------------------------------------linux系統下end---------------------------------------------- //特別聲明:windows下實現的預覽基本會按照原文檔樣式輸出,而linux下則是將內容轉化成text內容進行輸出,會“失真”。 如果有更好的方法希望可以分享出來。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看