md5 加密 出乱码 求解

2025-03-04 19:23:55
推荐回答(1个)
回答1:

md5
函数的第二个参数是可选的~bool型的~
虽然你传的是字符串~那么第二个参数就是true啦~
那么~第二个参数是什么用呢。。
看解释。
string
md5
(
string
str
[,
bool
raw_output]
)
Calculates
the
MD5
hash
of
str
using
the
RSA
Data
Security,
Inc.
MD5
Message-Digest
Algorithm,
and
returns
that
hash.
The
hash
is
a
32-character
hexadecimal
number.
If
the
optional
raw_output
is
set
to
TRUE,
then
the
md5
digest
is
instead
returned
in
raw
binary
format
with
a
length
of
16.
简单翻译一下:
用RSA
Data
Security,
Inc.
MD5
Message-Digest算法计算一个字符串
str
的MD5哈希值并返回.
这个哈希值是一个32个字符的16进制数.
如果可选参数raw_output设置为
true
,则md5函数将改为返回一个未加工的,长度为16的二进制格式的摘要.
---------------
当你把第二个参数设置为false。或者不填。就不会有乱码了。
echo
md5("admin");
echo
md5("admin",false);