【发布时间】:2018-06-13 10:04:46
【问题描述】:
我就是这样做的。这是正确的吗?
$filename = "../pdfs/reactjs_tutorial.pdf";
$handle = fopen($filename, 'rb');
$contents = fread($handle,filesize($filename));
fclose($handle);
$encoded = chunk_split(base64_encode($contents));
/*This is how I have done*/
【问题讨论】:
-
除了通过 Base-64 编码器运行文件并发送结果吗?
-
我已将其网址保存在数据库中,但根据 api 要求,我需要将 pdf 文件本身编码为 base 64 格式。
-
我需要发送编码格式的pdf文件
-
您是否尝试过在 Google 上搜索
base64 encode pdf file,您会发现数以千计的有用工具和指南。 -
不难
base64_encode(file_get_contents('/path/to/file.pdf'));