PHP中一种sign计算方法

时间:2020-11-30 10:52:46

一言不合上代码.........

 <?php
function getsign($data,$key){
$key=MD5("KEY_".$key."_K");
$sign=MD5(MD5($key.$data));
return $sign; } echo "?u=123456&p=".getsign("test123","key01_PasswordEncryptKey")."&s=".getsign("u=123456&p=".getsign("test123","key01_PasswordEncryptKey"),"key02_SignEncryptKey");

输出结果:

 ?u=123456&p=30413677987b25a9b4dd49205eb89a93&s=1c52ae0e7d6d31e311ff408eeadeaff5

(用户名123456密码test123)