由于PHP的allow_url_fopen设置而生成带有图像的pdf时出现FPDF问题 [英] FPDF issue while generating pdf with images due to PHP 'allow_url_fopen' setting

查看:63
本文介绍了由于PHP的allow_url_fopen设置而生成带有图像的pdf时出现FPDF问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在生成带有图像的PDF文件时,我遇到了FPDF的问题,如here所述.最终,我找到了解决此问题的原因,但是我不确定如何解决该问题,有人可以建议一些好的解决方案来解决该问题.

I am facing a problem with FPDF while generating the PDF file with images as explained here. Finally I found the reason for this issue but I am not sure how to fix that one, can anybody suggest some good solution to handle that issue.

此问题是由于服务器的 allow_url_fopen 设置引起的,如果启用该设置,则FPDF库将生成带有图像的PDF文件,也​​不会出现任何错误.

This problem is due to the allow_url_fopen setting of my server, if I enable that setting then the FPDF library is generating the PDF file with images also without any errors.

我正在为我的一个客户端站点使用此FPDF库,出于安全原因,他(客户端)禁用了"allow_url_fopen"设置,并且他不愿意启用该设置.如何在不启用服务器设置的情况下解决此问题.

I am using this FPDF library for one of my client sites, he(client) disabled the 'allow_url_fopen' setting for security reasons and he is not intersted to enable that setting. how can I solve this issue with out enabling that setting of my server.

推荐答案

您可以使用CURL打开远程资源.

You can use CURL to open remote resources.

$curlHandler=curl_init();

curl_setopt($curlHandler, CURLOPT_URL, "http://youurl.com");

curl_setopt($curlHandler, CURLOPT_HEADER,0);

curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, 1);

$output =curl_exec($curlHandler);

....

curl_close($curlHandler);

这篇关于由于PHP的allow_url_fopen设置而生成带有图像的pdf时出现FPDF问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆