我想将 uuid 作为 BINARY(16) 存储在数据库中,但我需要接受它们并将它们呈现为 XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 格式。在我跳到 PHP 代码中拆分 guid 之前(多么有趣!),是否有任何库或函数可以开箱即用?
最佳答案
您可以先使用 Replace() 删除破折号 然后使用 Unhex()
Performs the inverse operation of HEX(str). That is, it interprets each pair of hexadecimal digits in the argument as a number and converts it to the character represented by the number.
关于php - PHP 和 MySQL 中的 Guid/Uuid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1338698/