PHP生成唯一標識符token代碼
//sha1()函數(shù), "安全散列算法(SHA1)" function create_unique() { //客戶端+IP+時間戳+隨機數(shù)組成的字符串 $data = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'] .time() . rand(); //使用sha1加密 return sha1($data); } $newhash = create_unique(); echo "token方法1: ".$newhash."<br>"; $token = md5(uniqid(rand())); echo "token方法2: ".$token;
中國· 上海

添加微信咨詢
關鍵詞
辦公室:上海市浦東新區(qū)郭守敬路351號
CopyRight?2009-2019 上海谷谷網(wǎng)絡科技有限公司 All Rights Reserved. 滬ICP備11022482號-8
- top
- 在線咨詢
-
添加微信咨詢