How to use PHP to read PDF files online
This example describes how to use PHP to read PDF files online. Share it with everyone for your reference. The specific implementation method is as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<?php
if(!function_exists('read_pdf')) {
function read_pdf($file) {
if(strtolower(substr(strrchr($file,'.'),1)) != 'pdf') {
echo '文件格式不对.';
return;
}
if(!file_exists($file)) {
echo '文件不存在';
return;
}
header('Content-type: application/pdf');
header('filename='.$file);
readfile($file);
}
}
read_pdf('Python_study.pdf'); Copy after login
|
12345678910 11121314151617 |
|
I hope this article will be helpful to everyone’s PHP programming design. help.