PHP READ PPT FILE
2016-01-04 16:26
741 查看
function parsePPT($filename) { // This approach uses detection of the string "chr(0f).Hex_value.chr(0x00).chr(0x00).chr(0x00)" to find text strings, which are then terminated by another NUL chr(0x00). [1] Get text between delimiters [2] $fileHandle = fopen($filename, "r"); $line = fread($fileHandle, filesize($filename)); $lines = explode(chr(0x0f),$line); $outtext = ''; foreach($lines as $thisline) { if (strpos($thisline, chr(0x00).chr(0x00).chr(0x00)) == 1) { $text_line = substr($thisline, 4); $end_pos = strpos($text_line, chr(0x00)); $text_line = substr($text_line, 0, $end_pos); $text_line = preg_replace("/[^a-zA-Z0-9\s\,\.\-\n\r\t@\/\_\(\)]/"," ",$text_line); if (strlen($text_line) > 1) { $outtext.= substr($text_line, 0, $end_pos)."\n"; } } } return $outtext; } $filename = "test_pptk.ppt"; $ppt_string = parsePPT($filename);
相关文章推荐
- Laravel Query Builder Eloquent的where, findOrFail, firstByAttributes等在Phpstorm不提示得解决办法
- PHPUnit 在phpstrom中composer项目的应用配置
- Laravel5.1教程 前言
- php遍历指定路径下的所有文件和文件夹
- 大家须知简单的php性能优化注意点
- How can I capture the audio output with GStreamer?
- Mobile Detect:移动设备(手机和平板)检测的 PHP 类库
- PHP中读取文件的几个方法
- PHP采集利器snoopy应用详解
- PHP读取文本文件(TXT)
- PHP培训领航者兄弟连IT教育推出兄弟会教育模式
- 读取、设置 php.ini配置文件(复制)
- thinkphp 前台自定义标签中如何应对传递过来的ID?
- php json syntax_error语法错误的一个坑
- <php+mysql>上传文件到指定文件夹,共享数据和脚本,文件验证,脚本之间的通信
- php 获得浏览网页的用户的真实IP
- PHPCMS模版引擎兼容PHP7.0
- 简单的php性能注意点
- win7下php5.5安装solr扩展
- PHP拒绝服务攻击