打开目录错误;找不到这样的文件或目录

发布于 2025-01-03 03:41:14 字数 875 浏览 2 评论 0原文

这可能是一个非常简单的问题。我在目录 /mobile 中工作,并且在目录 /uploads 中有照片。

我收到错误:

警告:opendir(http://www.yoozpaper.com/uploads) [function.opendir]:无法打开目录:未在 /hermes/bosweb/web088/b881/ipg 中实现。 yoozpapercom/mobile/sportspage.php 第 313 行

我将其放入变量 $dir = "http://www.yoozpaper.com/uploads"

对于图像src=$dir/$file

请注意,当我处理主目录中的文件时,这是有效的。

对此的任何帮助将不胜感激。

代码如下:

$dir = "http://www.yoozpaper.com/uploads";

//打开目录

if ($opendir = opendir($dir))
{

//读取目录

while (($file = readdir($opendir)) !==FALSE)
{

if ($file==$imagename)

//下面可以指定高度和宽度

echo "<img width='75%' height='30%' src='$dir/$file' title='$headline - Yoozpaper News Online' alt='$headline'><br /><br />";

This may be a very easy question. I am working in directory /mobile and I have photos in a directory /uploads.

I am getting the error:

Warning: opendir(http://www.yoozpaper.com/uploads) [function.opendir]: failed to open dir: not implemented in /hermes/bosweb/web088/b881/ipg.yoozpapercom/mobile/sportspage.php on line 313

I am putting this into a variable $dir = "http://www.yoozpaper.com/uploads"

for the image src=$dir/$file.

Note that this is working when I am working with files in the main directory.

Any help on this would be greatly appreciated.

Code below:

$dir = "http://www.yoozpaper.com/uploads";

//open directory

if ($opendir = opendir($dir))
{

//read directory

while (($file = readdir($opendir)) !==FALSE)
{

if ($file==$imagename)

//can specify height and width below

echo "<img width='75%' height='30%' src='$dir/$file' title='$headline - Yoozpaper News Online' alt='$headline'><br /><br />";

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

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

发布评论

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

评论(2

青丝拂面 2025-01-10 03:41:14

您必须了解文件系统HTTP 守护进程之间的区别。
虽然外表有些相似,但本质上却是不同的。

要使用 opendir,您必须打开*目录,而不是 HTTP 资源。

opendir('../uploads');

应该工作

opendir($_SERVER['DOCUMENT_ROOT'].'/uploads');

会更好,因为它总是指向上传目录,无论您从哪里调用它。

You have to understand the difference between a filesystem and an HTTP daemon.
Although they have somewhat similar appearance, it is absolutely different matters.

To use opendir, you have to open *a directory, not HTTP resource.

opendir('../uploads');

should work

opendir($_SERVER['DOCUMENT_ROOT'].'/uploads');

would be better as it will always point to the uploads directory, no matter from where you called it.

染年凉城似染瑾 2025-01-10 03:41:14

http://www.yoozpaper.com/uploads 我们是 URL,而不是目录。您无法使用 opendir 访问它。您需要它的系统路径,例如“/home/user/public_html/uploads”或其他内容。使用文件管理器或控制面板获取目录路径

在您的情况下可能是“/hermes/bosweb/web088/b881/”。但我不确定。无论如何,获取本地路径

http://www.yoozpaper.com/uploads us a URL not a directory. You can't access it using opendir. You need the system path to it for example "/home/user/public_html/uploads" or something. Get the path to the directory using your file manager or control panel

It might "/hermes/bosweb/web088/b881/" in your case. m not sure though. In any case, get the local path

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文