如果你需要显示就应该用32位的字符串的, 第二个参数用默认值false

解决方案 »

  1.   

    我想得到16位唯一的,好像有些程序,discuz有这样的16位的,难道是自己写的算法?
      

  2.   

    你把32位的substr以下不就是16位了
      

  3.   

    Description
    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. bin2hex
    按16进制方式打印
      

  4.   

    不过bin2hex之后,有成了 32 位
      

  5.   

    32位的那个本来就是从16位的bin2hex变换过去的,或者说16位的是32位的hex2bin过去的,
    两者是等价的, 不同表示而已