我很惊讶PHP的filesize()在绝对路径上失败了??
我的文件在我的服务器上,除了将它们转换为相对路径之外,我如何获取文件大小(一团糟)?
编辑
例子:
$filename = 'http://172.16.xx.x/app/albums/002140/tn/020.jpg';
echo $filename . ': ' . filesize($filename) . ' bytes';
Warning: filesize() [function.filesize]: stat failed for http://172.16.xx.x/app/albums/002140/tn/020.jpg in /Applications/XAMPP/xamppfiles/htdocs/app/admin/+tests/filesize.php on line 26
结束编辑
我找到了这个远程文件的示例:
$filename = 'http://www.google.com/logos/2010/stevenson10-hp.jpg';
$headers = get_headers($filename, 1);
echo $headers['Content-Length']; // size in bytes
这个能在不下载文件的情况下工作吗?