我编写了一个脚本,使用以下选项列出Update目录中的文件:
文件名文件散列文件大小
出现此错误的原因:
Warning: filesize() [function.filesize]: stat failed for LinqBridge.dll in C:\xampp\htdocs\update.php on line 15我的php cod:
<?php
if(isset($_GET['action']) and ($_GET['action']=="list"))
{
$myDirectory = opendir("./Update/");
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
closedir($myDirectory);
$indexCount = count($dirArray);
sort($dirArray);
for($index=0; $index < $indexCount; $index++) {
if (substr("$dirArray[$index]", 0, 1) != "."){
echo $dirArray[$index]." ";
echo @hash_file('md5',$dirArray[$index])." ";
echo filesize($dirArray[$index])." ";
}
}
}
?>发布于 2012-06-22 03:15:49
$dirArray中的文件位于不同的目录中。您正在从"./Update/“读取它们,因此当执行文件大小、文件时间、文件时间或wahtever等操作时,您需要以"./Update/”作为前缀。
echo filesize("./Update/".$dirArray[$index])." ";https://stackoverflow.com/questions/11145115
复制相似问题