使用 md5_file();有时不返回md5?
<?php
include_once('booter/login/includes/db.php');
$query="SELECT * FROM shells";
$result=mysql_query($query);
while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
$hash = @md5_file($row['url']);
echo $hash . "<br>";
}
?>
以上是我的代码。通常它在大多数 url 上都能完美地工作,但时不时地它会跳过一行中的 md5,就好像它没有检索它一样,即使文件在那里。
我不明白为什么。有什么想法吗?
编辑:删除“@”时,它返回:
[function.md5-file]:无法打开流:没有这样的文件或目录
<?php
include_once('booter/login/includes/db.php');
$query="SELECT * FROM shells";
$result=mysql_query($query);
while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
$hash = @md5_file($row['url']);
echo $hash . "<br>";
}
?>
The above is my code. Usually it works flawlessly on most urls, but every now and then it will just skip the md5 on a line, as if it doesn't retrieve it, even though the file is there.
I can't figure out why. Any ideas?
EDIT: When removing the '@' it returns this:
[function.md5-file]: failed to open stream: No such file or directory
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
md5_file
前面的@
抑制可能出现的任何警告/错误。删除@
将允许显示md5_hash
中的错误,并让您了解为什么它偶尔会失败。没有这样的文件或目录
仅仅意味着不存在具有已搜索名称的文件。您可能想要检查导致这些警告的 URL;也许它们引用了已重命名或移动的文件。The
@
in front ofmd5_file
suppresses any warnings/errors that might be raised. Removing the@
will allow errors frommd5_hash
to be displayed and will allow you to see why it is occasionally failing.No such file or directory
simply means that there is no file with the name that has been searched. You might want to inspect the URLs that are causing those warnings; maybe they refer to a file that has been renamed or moved.