Home >Backend Development >PHP Tutorial >How to read PDF files online with PHP, _PHP tutorial

How to read PDF files online with PHP, _PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:49:561033browse

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');

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...
Statement:
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