PHP-md5_file() 函数

2010年05月14日 19:09  |  分类:PHP技术

定义和用法

md5_file() 函数计算文件的 MD5 散列。 

md5() 函数使用 RSA 数据安全,包括 MD5 报文摘译算法。 

如果成功,则返回所计算的 MD5 散列,如果失败,则返回 false。 

(PHP 4 >= 4.2.0, PHP 5)  

md5_file – Calculates the md5 hash of a given file 

说明

string md5_file ( string filename [, bool raw_output] )

Calculates the MD5 hash of the file specified by the filename parameter using the RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash. The hash is a 32-character hexadecimal number.  
参数

  filename

The filename raw_output
When TRUE, returns the digest in raw binary format with a length of 16. Defaults to FALSE
返回值 

Returns a string on success, FALSE otherwise

例如

<?php
$filename = “test.txt”;
$md5file = md5_file($filename);
echo $md5file;
?>

输出:

5d41402abc4b2a76b9719d911017c592

原创文章,转载请注明: 转载自长沙营销型网站建设,营销型网站开发,Zen-Cart | 小龙包

本文链接地址: PHP-md5_file() 函数