0

为什么我会收到此错误:

致命错误:在第 3 行的 /home/se7encla/public_html/dir.php 中调用未定义函数 getfilelist()

以及如何解决?!

第 3 行是

 $dirlist = getFileList("./Update/");

目录.php

 <?PHP
 // examples for scanning a directory called images
 $dirlist = getFileList("./Update/");
?>

回声.php

<?PHP
 // output file list as HTML table
  foreach($dirlist as $file) {
echo "<tr>\n";
echo "<td>{$file['name']}</td>\n";
echo "<td>{$file['Stream']}</td>\n";
echo "<td>{$file['size']}</td>\n";
 }
echo "\n";
?>

更新.php

 <?PHP
  if(isset($_GET['action']) and ($_GET['action']=="list"))
{
require_once "./dir.php";
require_once "./echo.php";

 function getFileList($dir)
  {
// array to hold return value
$retval = array();

// add trailing slash if missing
if(substr($dir, -1) != "/") $dir .= "/";

// open pointer to directory and read list of files
$d = @dir($dir) or die("getFileList: Failed opening directory $dir for reading");
while(false !== ($entry = $d->read())) {
  // skip hidden files
  if($entry[0] == ".") continue;
  if(is_dir("$dir$entry")) {
    $retval[] = array(
      "name" => "$dir$entry",
      "size" => 0,
       "Stream" => md5_file("$dir$entry")
    );
  } elseif(is_readable("$dir$entry")) {
   $retval[] = array(
      "name" => "$entry",
      "size" => filesize("$dir$entry"),
     "Stream" => md5_file("$dir$entry")
    );
  }
  }
 $d->close();

  return $retval;
 }
 }
 ?>
4

0 回答 0