openssl_random_pseudo_bytes
PHP 関数の読み取り不能文字を出力します。
この関数を使用して、一意の文字列を生成します。
<?php
header('content-type:text/plain ; charset=utf-8');
$uniqid=openssl_random_pseudo_bytes(30 );
echo $uniqid ;
?>
次のような出力:
#~�p�x�6�;g�ic�-z"���:i�
openssl_random_pseudo_bytes
PHP 関数の読み取り不能文字を出力します。
この関数を使用して、一意の文字列を生成します。
<?php
header('content-type:text/plain ; charset=utf-8');
$uniqid=openssl_random_pseudo_bytes(30 );
echo $uniqid ;
?>
次のような出力:
#~�p�x�6�;g�ic�-z"���:i�
PHPにはuniqid関数のようなものがあります
あなたはこれを試すことができます:
<?php
printf("uniqid(): %s\r\n", uniqid());echo '<br>';
printf("uniqid('php_'): %s\r\n", uniqid('php_'));echo '<br>';
printf("uniqid('', true): %s\r\n", uniqid('', true));echo '<br>';
?>
参考: http: //php.net/manual/en/function.uniqid.php