php读取pdf文件
生活随笔
收集整理的這篇文章主要介紹了
php读取pdf文件
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.compoer安裝相關的包
composer require smalot/pdfparser2.代碼
<?php namespace app\controller; use app\BaseController; use Smalot\PdfParser\Parser;class Pdf extends BaseController {public function index(){$filename ='./shell.pdf';$parser = new Parser();$pdf = $parser->parseFile($filename);$text = $pdf->getText(); //將所有內容讀取到一個字符串中return show(1,"ok",$text);} }3.結果
注意:讀取的pdf文件不全
總結
以上是生活随笔為你收集整理的php读取pdf文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php读取word中的内容
- 下一篇: PHP实现简易版区块链