How to read PDF files online with PHP, _PHP tutorial

WBOY
Release: 2016-07-13 09:49:56
Original
1011 people have browsed it

How to use PHP to read PDF files online,

The example in this article describes how to use PHP to read PDF files online. Share it with everyone for your reference. The specific implementation method is as follows:

<&#63;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

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1018518.htmlTechArticleHow to use PHP to read PDF files online. This article describes how to use PHP to read PDF files online. Share it with everyone for your reference. The specific implementation method is as follows: phpif(!functi...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template