To register with a MQTT service I need a unique client ID inside a Docker container. Does the PHP function uniqid() work for that?
$uniqueId = uniqid();
Or is it better to combine this with the Docker container ID? What is PHP oneliner code for that?
uniqid ([ string $prefix = "" [, bool $more_entropy = FALSE ]] ) : string
Gets a prefixed unique identifier based on the current time in microseconds.
Caution
This function does not generate cryptographically secure values, and should not be used for cryptographic purposes. If you need a cryptographically secure value, consider using random_int(), random_bytes(), or openssl_random_pseudo_bytes() instead.
If you are using
$id = uniqid (null, true);
You should be totally fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.