Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用php搜索pdf文件_Php_Pdf - Fatal编程技术网

用php搜索pdf文件

用php搜索pdf文件,php,pdf,Php,Pdf,我有一个网站,内容主要是pdf。当用户从表单中输入关键字,然后显示包含该关键字的pdf文件时,是否有可能通过该关键字进行搜索您可以用来从pdf获取文本 例如: $pdf = new PDF2Text(); $pdf->setFilename('pdffile.pdf'); //select the pdf $pdf->decodePDF(); //process the pdf echo $pdf->output(); //output the text from the PD

我有一个网站,内容主要是pdf。当用户从表单中输入关键字,然后显示包含该关键字的pdf文件时,是否有可能通过该关键字进行搜索

您可以用来从pdf获取文本

例如:

$pdf = new PDF2Text();
$pdf->setFilename('pdffile.pdf'); //select the pdf
$pdf->decodePDF(); //process the pdf
echo $pdf->output(); //output the text from the PDF

如果要按单词搜索,可以使用列为
word
pdf
的表在数据库中创建索引,并用从文件读取的单词及其在服务器上的位置填充索引。您不必为每个请求扫描所有文件,只需查询数据库即可


可以创建类似的解决方案或其他类型的搜索。

欢迎使用StackOverflow,请使用。谢谢,让我试试