900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > php解析mht文件转换成html办法

php解析mht文件转换成html办法

时间:2018-07-23 06:12:04

相关推荐

php解析mht文件转换成html办法

后端开发|php教程

html,php,方法

后端开发-php教程

本篇文章主要介绍php解析mht文件转换成html的方法,感兴趣的朋友参考下,希望对大家有所帮助。

微信小程序 微社区 源码,添加vscode系统变量,ubuntu卸载包,打开tomcat网页,qt sqlite3 数量,树林里棕色的爬虫是什么,php采集程序,江西seo优化热线,html5 网站zhongwen模板,源网页美女大全图片,装企营销系统免费模板lzw

php解析mht文件,使用编辑器打开可以看到base64编码所以,mht是可以转换成html的。

简单的.net源码,ubuntu某个分区太大,爬虫脚本违法吗,php网站开发教程第9课技术,seo公关教程lzw

set_file ( $filename );$o_mhtml->extract ();return $o_mhtml->get_part_to_file(0);}return null;}function mhtmlParseAll($filename) {if (file_exists ( $filename )) {if (is_dir ( $filename )) return false;$filename = strtolower ( $filename );if (strpos ( $filename, .mht, 1 ) == FALSE) return false;$o_mhtml = new mhtml ();$o_mhtml->set_file ( $filename );$o_mhtml->extract ();return $o_mhtml->get_all_part_file();}return null;}*/class mhtparse {var $file = \;var $boundary = \;var $filedata = \;var $countparts = 1;var $log = \;function extract() {$this->read_filedata ();$this->file_parts ();return 1;}function set_file($p) {$this->file = $p;}function get_log() {return $this->log;}function file_parts() {$lines = explode ( "\n", substr ( $this->filedata, 0, 8192 ) );foreach ( $lines as $line ) {$line = trim ( $line );if (strpos ( $line, = ) !== FALSE) {if (strpos ( $line, oundary, 0 ) !== FALSE) {$range = $this->getrange ( $line, \", \", 0 );$this->boundary = "--" . $range [ ange];$this->filedata = str_replace ( $line, \, $this->filedata );break;}}}if ($this->boundary != \) {$this->filedata = explode ( $this->boundary, $this->filedata );unset ( $this->filedata [0] );$this->filedata = array_values ( $this->filedata );$this->countparts = count ( $this->filedata );} else {$tmp = $this->filedata;$this->filedata = array ($tmp );}}function get_all_part_file() {return $this->filedata;}function get_part_to_file($i) {$line_data_start = 0;$encoding = \;$part_lines = explode ( "\n", ltrim ( $this->filedata [$i] ) );foreach ( $part_lines as $line_id => $line ) {$line = trim ( $line );if ($line == \) {if (trim ( $part_lines [0] ) == --)return 1;$line_data_start = $line_id;break;}if (strpos ( $line, : ) !== FALSE) {$pos = strpos ( $line, : );$k = strtolower ( trim ( substr ( $line, 0, $pos ) ) );$v = trim ( substr ( $line, $pos + 1, strlen ( $line ) ) );if ($k == content-transfer-encoding) {$encoding = $v;}if ($k == content-location) {$location = $v;}if ($k == content-type) {$contenttype = $v;}}}foreach ( $part_lines as $line_id => $line ) {if ($line_id file, );$this->filedata = fread ( $handle, filesize ( $this->file ) );fclose ( $handle );}function getrange(&$subject, $Beginmark_str = {, $Endmark_str = }, $Start_pos = 0) {/* * $str="sssss { x { xx } {xx{xx } x} x} sssss"; $range=string::getRange($str,{,},0); echo $range[ ange]; //tulem: " x { xx } {xx{xx } x} x" echo $range[ehin]; //tulem: 6 echo $range[end]; //tulem: 30 ( ) -- l5pumärgist järgnev out: array( ange=>$Range,egin=>$Begin_firstOccurence_pos,end=>$End_sequel_pos) | false v1.1 -,Uku-Kaarel J5esaar,ukjoesaar@hot.ee,http://www.hot.ee/ukjoesaar,+3725110693 */if (empty ( $Beginmark_str ))$Beginmark_str = {;$Beginmark_str_len = strlen ( $Beginmark_str );if (empty ( $Endmark_str ))$Endmark_str = };$Endmark_str_len = strlen ( $Endmark_str );/* $Start_pos_cache = 0; */do {/* !algus */if (! is_int ( $Begin_firstOccurence_pos ))$Start_pos_cache = $Start_pos;/* ?algus-test */$Start_pos_cache = @strpos ( $subject, $Beginmark_str, $Start_pos_cache );/* this is possible start for range */if (is_int ( $Start_pos_cache )) {/* skip */$Start_pos_cache = ($Start_pos_cache + $Beginmark_str_len);/* test possible range start pos */if (is_int ( $Begin_firstOccurence_pos )) {if ($Start_pos_cache $range_end_pos)$rangeClean = 1;}/* here it is */if (! is_int ( $Begin_firstOccurence_pos ))$Begin_firstOccurence_pos = $Start_pos_cache;} /* VIGA NR 0 ALGUST EI OLE */if (! is_int ( $Start_pos_cache )) {/* !algus *//* VIGA NR 1 ALGUSMARKI EI LEITUD : VIIMANE VOIMALIK ALGUS */if (is_int ( $Begin_firstOccurence_pos ) and ($Start_pos_cache < $range_end_pos))$rangeClean = 1;elsereturn false;}if (is_int ( $Begin_firstOccurence_pos ) and ($rangeClean != 1)) {if (! is_int ( $End_pos_cache ))$End_sequel_pos = $Begin_firstOccurence_pos;$End_pos_cache = strpos ( $subject, $Endmark_str, $End_sequel_pos );/* ok */if (is_int ( $End_pos_cache ) and ($rangeClean != 1)) {$range_current_lenght = ($End_pos_cache - $Begin_firstOccurence_pos);$End_sequel_pos = ($End_pos_cache + $Endmark_str_len);$range_end_pos = $End_pos_cache;}/* VIGA NR 2 LOPPU EI LEITUD */if (! is_int ( $End_pos_cache ))if ($End_pos_cache == false)return false;}} while ( $rangeClean $Range,egin => $Begin_firstOccurence_pos,end => $End_sequel_pos );} // end getrange()} // class?>

推广赚佣金源码,vscode cpp使用教程,ubuntu16 安装,tomcat启动端口,sqlite 封装库,网页设计图怎么收费,.net 数据库备份,公司建共享服务器,jquery json插件下载,java框架简单弄前端,豌豆荚爬虫,php发邮件,seo是什么职位,导出springboot,dedecms if标签,网站扒站工具,网页复制文本,mfc工程模板创建,二级栏目在后台找不到,登录页面的html代码怎么写,网上文件管理系统,房贷小程序源码lzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。