• PHP READ PPT FILE


    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-9s\,.-
    
    	@/\_()]/"," ",$text_line);
                if (strlen($text_line) > 1) {
                    $outtext.= substr($text_line, 0, $end_pos)."
    ";
                }
            }
        }
    
        return $outtext;
    }
    
    $filename = "test_pptk.ppt";
    $ppt_string = parsePPT($filename);
  • 相关阅读:
    1
    最大子串
    线段树
    mybatis分页插件
    springmvc下载文件
    获“领跑衫”感言
    finnal 评论 II
    用户使用报告
    事后诸葛亮会议 (尸体解剖)
    final阶段成员贡献分
  • 原文地址:https://www.cnblogs.com/archoncap/p/5099383.html
Copyright © 2020-2023  润新知