imagecreatefrompng()无法打开流:HTTP请求失败 [英] imagecreatefrompng() failed to open stream: HTTP request failed

查看:921
本文介绍了imagecreatefrompng()无法打开流:HTTP请求失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的本地主机上,此代码效果很好:

On my local host this code works well:

$im = imagecreatefrompng('BBcode.png');

但是当我在服务器中使用相同的代码时

But when I use the same code in the server

$im = imagecreatefrompng('http://lazertag.elitno.net/drupal/BBcode.png');

我收到了以下错误消息:

I got the folloowing error:


警告:
imagecreatefrompng(http://lazertag.elitno.net/drupal/BBcode.png)
[function.imagecreatefrompng]:无法打开流:HTTP请求
失败了! HTTP / 1.1 403禁止在
/www/elitno.net/l/a/lazertag/home/site/drupal/renderImage.php上线
46

Warning: imagecreatefrompng(http://lazertag.elitno.net/drupal/BBcode.png) [function.imagecreatefrompng]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /www/elitno.net/l/a/lazertag/home/site/drupal/renderImage.php on line 46

我如何解决这个问题?

推荐答案

如果文件在您的服务器上,使用(相对)系统路径,而不是网址:
例如:

If the file is on your server, use a (relative) system path, not an url: E.g.:

$im = imagecreatefrompng('drupal/BBcode.png');

这篇关于imagecreatefrompng()无法打开流:HTTP请求失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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