PHP getimagesize() 问题

发布于 2024-08-25 01:08:42 字数 386 浏览 0 评论 0原文

我在 PHP 中使用 getimagesize() 函数,它不断返回错误:

getimagesize(image.php?name=用户名&pic=图片) [function.getimagesize]: 无法打开流: 没有这样的文件或目录

我没有用它做任何奇怪的事情。我能想象到的唯一问题是路径 URL 是另一个 PHP 脚本,它返回带有图像标题的页面,并且该 URL 中有一个 & 符号。

这是我的代码:

$location = "image.php?name=username&pic=picture";
$size = getimagesize($location);

I'm using the getimagesize() function in PHP and it keeps returning an error:

getimagesize(image.php?name=username&pic=picture) [function.getimagesize]: failed to open stream: No such file or directory

I'm not doing anything strange with it. The only problem I can imagine is that the path URL is another PHP script that returns a page with an image header, and there is an ampersand in that URL.

Here is my code:

$location = "image.php?name=username&pic=picture";
$size = getimagesize($location);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

‖放下 2024-09-01 01:08:42

您期望 php 脚本被执行吗?在这种情况下,您不应该尝试直接打开文件(它不会被执行)
你应该做类似的事情

$location = "http://server.com/image.php?name=username&pic=picture";
$size = getimagesize($location);

You are expecting the php script to get executed? In that case you shouldn't try to open the file directly (it wont be executed)
you should do something like

$location = "http://server.com/image.php?name=username&pic=picture";
$size = getimagesize($location);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文