php实现将上传word文件转为html的方法

前端之家收集整理的这篇文章主要介绍了php实现将上传word文件转为html的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文实例讲述了PHP实现将上传word文件转为html的方法分享给大家供大家参考。具体实现方法如下:

上传页面

<a href="https://www.jb51.cc/tag/wenjian/" target="_blank" class="keywords">文件</a><a href="https://www.jb51.cc/tag/shangchuan/" target="_blank" class="keywords">上传</a>
PHP" method="post" enctype="multipart/form-data">

接收页面

PHP;"> 接收<a href="https://www.jb51.cc/tag/shangchuan/" target="_blank" class="keywords">上传</a><a href="https://www.jb51.cc/tag/wenjian/" target="_blank" class="keywords">文件</a> Open($connstr); $uploaddir = 'uploads/'; if(!is_dir($uploaddir)){ mkdir($uploaddir); } $filename =$_FILES['filename']['name']; $filename =substr($_FILES['filename']["name"],strpos($_FILES['filename']["name"],".")); echo $filename; echo "
"; $uploadfile = $uploaddir.$filename.substr($_FILES['filename']["name"],".")); //目录名.文件名.后缀名 echo $uploadfile; echo "
"; $temploadfile = $_FILES['filename']['tmp_name']; echo $temploadfile; echo "
"; move_uploaded_file($temploadfile,$uploadfile); //移动文件 $path = $_SERVER['SCRIPT_FILENAME']; $filepath = $_SERVER["PHP_SELF"]; $path = substr($path,strpos($path,$filepath)); echo $path; echo "
"; echo $filepath; $htmlpath = $path."/shiyan4/".$uploadfile; echo "
"; echo $htmlpath; word2html($htmlpath); //$query =@MysqL_query( "Insert into $username(fname,file)values('$filename','$uploadfile')")or die("error"); ?> visible = 1 ; $word->Documents->Open($wfilepath)or die("无法打开这个文件"); $htmlpath=substr($wfilepath,-4); $word->ActiveDocument->SaveAs($htmlpath,8); $word->quit(0); } print( "Word转html完成!" ); ?>

希望本文所述对大家的PHP程序设计有所帮助。

原文链接:https://www.f2er.com/php/21843.html

猜你在找的PHP相关文章