Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有:
$token = sha1(uniqid(mt_rand(), true));
然后我将使用unhex('$token'). 我如何选择这个值?
unhex('$token')
我试过了:
SELECT token FROM `name` WHERE `id` = 1 LIMIT 1
如果我在其中回显它,它将显示为0b7GÞ÷:‹xcÅ•½JAjdäáæ而不是类似 5dc012f007b7c4db7b9e076138fdd92fa1039530
0b7GÞ÷:‹xcÅ•½JAjdäáæ
5dc012f007b7c4db7b9e076138fdd92fa1039530
我究竟做错了什么?
我认为您不需要将其与 一起存储UNHEX,但您可以SELECT HEX(token)取回原始值。
UNHEX
SELECT HEX(token)