(PECL OAuth >= 1.0.0)
OAuthProvider::generateToken — Generate a random token
final public static OAuthProvider::generateToken ( int $size [, bool $strong = false ] ) : string
Generates a string of pseudo-random bytes.
size
The desired token length, in terms of bytes.
strong
Setting to true
means /dev/random
will be used for entropy, as otherwise the non-blocking /dev/urandom
is used. This parameter is ignored on Windows.
The generated token, as a string of bytes.
If the strong
parameter is true
, then an E_WARNING
level error will be emitted when the fallback rand() implementation is used to fill the remaining random bytes (e.g., when not enough random data was found, initially).
Note:
When not enough random data is available to the system, this function will fill the remaining random bytes using the internal PHP rand() implementation.
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/oauthprovider.generatetoken.php