2013-07-31 453 views

回答

4

你将需要:

  1. 区分文件类型

    $file_name = $_FILES['image']['name']; 
    $file_extn = end(explode(".", strtolower($_FILES['image']['name']))); 
    
    if($file_extn == "doc" || $file_extn == "docx"){ 
        docx2text(); 
    }elseif($file_extn == "rtf"){ 
        rtf2text(); 
    } 
    
  2. 将文档转换为文本

    https://stackoverflow.com/a/7371315/2512934 DOC或DOCX http://webcheatsheet.com/php/reading_the_clean_text_from_rtf.php为RTF

  3. 算的话 http://php.net/manual/en/function.str-word-count.php

+0

谢谢您回复:)这对于.docx非常适用,但不幸的是不适用于.rtf。 不要以为你可以帮助我呢? :) –

+0

我编辑了答案。如果我已回答您的问题,请将我的标记标记为问题的答案。 –