PHP 로 guid(uuid) 만들기

2019.02.27 15:15

졸리운_곰 조회 수:760

PHP 로 guid(uuid) 만들기

PHP

Its easy to make GUIDs in PHP. Below is clean code using windows COM to get GUIDs. When the PHP creates GUIDs or UUIDs they are V4 guids.

1
2
$guid = com_create_guid();
echo $guid;

If you are not a on windows based platform you can roll this code for making GUIDs in PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function getGUID(){
    if (function_exists('com_create_guid')){
        return com_create_guid();
    }else{
        mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
        $charid = strtoupper(md5(uniqid(rand(), true)));
        $hyphen = chr(45);// "-"
        $uuid = chr(123)// "{"
            .substr($charid, 0, 8).$hyphen
            .substr($charid, 8, 4).$hyphen
            .substr($charid,12, 4).$hyphen
            .substr($charid,16, 4).$hyphen
            .substr($charid,20,12)
            .chr(125);// "}"
        return $uuid;
    }
}

To use the above functon:

1
2
$GUID = getGUID();
echo $GUID;

code thanks to: rodsdot These guys are so GUID they UUed my ID.

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

[출처] http://guid.us/GUID/PHP

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
117 Building a RESTful API Using ReactPHP and MySQL file 졸리운_곰 2020.07.01 1772
116 [PHP 웹개발] MySQL 데이터베이스에서 mysqli(MySQL Improved) 사용법 졸리운_곰 2020.05.07 67
115 PHP 파일 업로드와 다운로드 만들기 file 졸리운_곰 2020.05.07 423
114 HOW TO INTEGRATE R WITH PHP : php와 R 언어의 연동 file 졸리운_곰 2020.05.05 289
113 XAMPP, PhpStorm, Hello World 출력하기 졸리운_곰 2020.03.27 67
112 Pico is a stupidly simple, blazing fast, flat file CMS. file 졸리운_곰 2020.03.19 53
111 directorylister php 사용법 file 졸리운_곰 2020.03.18 152
110 flat file 플랫파일시스템 : GRAV CMS file 졸리운_곰 2020.03.18 90
109 내가 본 워드프레스 핵심 구조 및 기능 (Wordpress Architecture and Function) file 졸리운_곰 2020.02.20 53
108 [php machine learing] 회귀 분석 phpml 졸리운_곰 2020.02.06 128
107 [php machine learning] PHP-ML을 이용한 분류 졸리운_곰 2020.02.06 191
106 PHP-CRUD-API [mysql 및 데이터베이스 자동 미들웨어(middleware) by php] file 졸리운_곰 2020.01.25 105
105 Docker를 이용하여 멀티플랫폼에서 MSSQL + Laravel을 개발해보자. file 졸리운_곰 2020.01.23 347
104 PHP 기반의 Micro Frameworks 정리 졸리운_곰 2019.11.19 60
103 Micro-Framework, Lumen 살펴보기 file 졸리운_곰 2019.11.19 38
102 라라벨-루멘-PHP 날코딩 성능 비교 file 졸리운_곰 2019.11.19 145
101 Using WordPress with Lumen 졸리운_곰 2019.11.06 146
100 Micro-Framework, Lumen 살펴보기 file 졸리운_곰 2019.11.05 87
» PHP 로 guid(uuid) 만들기 졸리운_곰 2019.02.27 760
98 PHP 리다이렉션(페이지 이동)의 3가지 방법 졸리운_곰 2019.01.11 119
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED