番号順として使用するトークン/キーを作成する必要があるため、これは一意である必要があり、トークンは「6X990742MG185953R」のようなものである必要があるため、バーコードのように使用できます。http://barcodes4.me/barcode/c128b/6X990742MG185953R.png
UUID や GUID は長すぎるため使用できません。近いほど次のようになります。
function uuid64() {
$uuid = uuid(); // some UUID v4
$byteString = "";
$uuid = str_replace("-", "", $uuid);
for($i = 0; $i < strlen($uuid); $i += 2) {
$s = substr($uuid, $i, 2);
$d = hexdec($s);
$c = chr($d);
$byteString = $byteString.$c;
}
$b64uuid = base64_encode($byteString);
// Replace the "/" and "+" since they are reserved characters
$b64uuid = str_replace("/", "_", $b64uuid);
$b64uuid = str_replace("+", "-", $b64uuid);
// Remove the trailing "=="
$b64uuid = substr($b64uuid, 0, strlen($b64uuid) - 2);
return $b64uuid;
}