PHP uniqid() 함수
예시
고유 ID 생성:
<?php
echo uniqid();
?>
정의 및 사용
uniqid() 함수는 마이크로타임(마이크로초 단위의 현재 시간)을 기반으로 고유 ID를 생성합니다.
참고: 이 함수에서 생성된 ID는 반환 값의 고유성을 보장하지 않습니다! 매우 예측하기 어려운 ID를 생성하려면 md5() 함수를 사용하십시오.
통사론
uniqid(prefix,more_entropy)
매개변수 값
Parameter | Description |
---|---|
prefix | Optional. Specifies a prefix to the unique ID (useful if two scripts generate ids at exactly the same microsecond) |
more_entropy | Optional. Specifies more entropy at the end of the return value. This will make the result more unique. When set to TRUE, the return string will be 23 characters. Default is FALSE, and the return string will be 13 characters long |
기술적 세부 사항
반환 값: | 고유 식별자를 문자열로 반환 |
---|---|
PHP 버전: | 4+ |
변경 로그: | 접두사 매개변수는 PHP 5.0에서 선택 사항이 되었습니다 . PHP 4.3.1에서 접두어 의 114자 제한 이 증가했습니다. |
❮ PHP 기타 참조