php - 将 PDF 文件另存为 PDF 而不是 PHP
问题描述
我正在使用 FPDF 创建 pdf 文件。但它显示扩展为 php 而不是 pdf。当我在手机中下载文件时,它会显示 .php 文件。现在如何将 php 扩展名转换为 pdf
这里 index.php 文件
<a href="pdf.php">Click Here</a>
这里 pdf.php 文件
<?php
require ("fpdf/fpdf.php");
$name = "Amit Samadder";
$pdf = new FPDF('p','mm','A4');
$pdf->AddPage();
$pdf->SetFont("Arial","B","20");
$pdf->Cell(100,10, $name, 1,0, "C");
$pdf->Output();
?>
解决方案
推荐阅读
- javascript - FireBase 重复推送
- c++ - QTimer 超时不会在单元测试中触发
- c# - 用户控件中的 DataGrid 引发异常无法转换类型为“MS.Internal.NamedObject”的对象
- reactjs - 使用 const { icon, ...other } = this.props 时出现语法错误;
- javascript - 将数组值分配给应用程序脚本中的变量时出错
- dialogflow-es - 识别国际区域代码电话号码中的“加号”的 DialoFlow 问题
- python - 十六进制到二进制:binascii.unhexlify 的奇数长度字符串错误
- ios - 在 iPhone x 上滚动时 UITableview 有底部空间
- ios - iOS-(Swift 中的`FirebaseApp.configure()`)在使用 Firebase 数据库之前。
- ruby - 支持字符串格式#% rubocop