在循环中使用pdf2text类

时间:2013-03-12 14:31:38

标签: php

我正在尝试将几个pdf中的数据提取到数据库中,然后我找到了代码,但每次输入单个文件时我只能使用它。

我正在使用资源class.pdf2text.php @ http://pastebin.com/hRviHKp1

使用代码:

*#this is outside of the loop
   include('class.pdf2text.php'); 

   #this is inside the loop
   $a = new PDF2Text();
   $a->setFilename('$userDoc'); //grab the test file at    
   $a->decodePDF();
   echo $a->output();*

我遇到的问题是在成功完成第一个文档之后,所有文档都返回此错误致命错误:无法在第4行的class.pdf2text.php中重新声明类PDF2Text

1 个答案:

答案 0 :(得分:0)

你再次以某种方式包括课程,没有更多的代码我们不能如何。您可以改为使用include而不是include_once使用{{1}}来修复错误。