使用服务器上的 php 以编程方式检查 md5sum

发布于 2024-09-07 23:28:18 字数 196 浏览 1 评论 0原文

我不确定我所问的是否可能。您知道当您下载某些内容时,可以对其运行 md5sum 检查以验证它在传输时没有损坏。

好吧,我正在尝试在服务器上以编程方式执行相同的操作。该文件将被下载到 Web 根文件夹或其他文件夹,我想对其运行 php 脚本来计算其 md5sum。 php可以做到这一点吗?

我目前正在开发环境 wampserver2 上进行测试。

I'm not sure if what I'm asking is possible. You know how when you download something, you can run an md5sum check on it to verify it hasn't been corrupted when transmitted.

Well, I'm trying to do the same thing programmatically on the server. The file would have been downloaded to the web root folder or some other folder, and I want to run a php script against it to calculate its md5sum. Can php do this?

I'm currently testing on a development environment, wampserver2.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜空下最亮的亮点 2024-09-14 23:28:18
echo md5_file("path/to/file");
echo md5_file("path/to/file");
半透明的墙 2024-09-14 23:28:18

像这样简单的事情应该可以完成工作:

echo md5(file_get_contents("your-filename-here"));

但不要依赖它非常快。

Something as simple as this should do the job:

echo md5(file_get_contents("your-filename-here"));

But don't rely on it being exceptionally fast.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文