开发者

Checking md5sum programmatically with php on server

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 down开发者_StackOverflow中文版loaded 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.


echo md5_file("path/to/file");


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜