如何使用'antiword'读取包含gap i文件名的文件?

时间:2012-06-05 14:16:19

标签: ms-word file-get-contents file-format file-conversion readfile

我使用'antiword'将MSword文档转换为文本。  我有一个名为“care job house keeper catering job13806.doc”的文件,如果在脚本中传递,则antiword无法读取此内容。

  public function Convert($filenames) {         
    return $content = shell_exec('antiword'." ".$filenames.' -');//dash at the end to output content        
}

如果通过键入antiword手动输入文件名并在少量知名文章后按Tab键,它将如下所示并完美执行。

$ antiword care\ job\ housekeeper\ catering\ job13806.doc

1 个答案:

答案 0 :(得分:0)

使用引号:

shell_exec("antiword '$filename' -");

那会产生:

antiword 'care job housekeeper catering job13806.doc' -