【问题标题】:opendir() failed to open dir, not impemented inopendir() 未能打开目录,未实现
【发布时间】:2016-05-26 16:58:17
【问题描述】:

我正在尝试编写一些 php 来从服务器上的文件制作图像幻灯片。当我尝试打开目录时,它给了我标题中的错误

$images = glob('*.{jpg,jpeg,png,gif}', GLOB_BRACE);
$count = count($images);
$var_count = $count + 1;

$arr_img = Array();
$handle = opendir('http://dev2.matrix.msu.edu/~matrix.training/Holmberg_Dane');
while (false !== ($file = readdir($handle))) {
 if ($file != "." && $file != "..") {
    $arr_img[] = $file;
 }
}

【问题讨论】:

标签: php warnings slideshow opendir


【解决方案1】:

您不能在 HTTP 地址上调用 opendir()。 HTTP 没有“目录”的概念(除非你算上 WebDAV)。

【讨论】:

  • 那么如何从服务器访问我需要的目录呢?
  • @daneholmberg 要么让服务器读取目录本身并以 JSON 等机器可读格式返回内容,要么(假设您的服务器实际上设置为自动生成 Apache 目录列表)解析服务器输出的 HTML 目录列表。
猜你喜欢
  • 2018-10-08
  • 1970-01-01
  • 2015-04-12
  • 1970-01-01
  • 2023-04-05
  • 2015-10-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多