일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- PHP 구글 OTP 연동
- javascript
- group_concat 구분자
- sha-2 root
- 비밀번호정규식
- wkhtmltopdf 실행 오류
- mariadb upgrade
- libxrender1
- PHP 구글 OTP 인증
- usb efi 시스템 파티션 삭제
- html pdf 변환
- mysql root 비밀번호 변경
- httpd.conf 보안 설정
- PHP 정규식 예제
- svn 충돌 해결 resolved
- bootstrap
- 우분투 mysql 비밀번호 없이 로그인 될때
- 비밀번호검증정규식
- apache mod rewrite
- mysqldump: Got error: 1045
- (using password: YES)" when trying to connect
- 파라미터 & 오류
- svn 충돌 해결 resolve
- apple push notification service (apns) is changing
- php 배열제거
- 구글 OTP 인증
- modsecurity 설치
- 자바스크립트비밀번호검증
- 아파치 웹 서버의 정보 숨기기
- bootstrap modal
- Today
- Total
투덜이 개발자
PHP 한글 도메인 퓨니코드 변환 (Punycode) 본문
PHP에서 이런 한글도메인-퓨니코드간 변환을 하기 위해서는, INTL extension이 필요하다.
1. icu 설치
yum install icu
yum install libicu
yum install libicu-devel
2. 적절한 intl extension 다운로드
http://pecl.php.net/package/intl
wget http://pecl.php.net/get/intl-3.0.0.tgz
3. 다운로드한 extension 컴파일
tar xvfz intl-3.0.0.tgz
cd intl-3.0.0
phpize
./configure
make
make test( 생략 가능 )
make install
4. php.ini 에 설정
extension = intl.so
<?PHP
if (extension_loaded('intl')) {
// 한글도메인 -> 퓨니코드
echo idn_to_ascii('한글.com'); // xn--bj0bj06e.com
// 퓨니코드 -> 한글도메인
echo idn_to_utf8('xn--bj0bj06e.com'); // 한글.com
}
else echo '[ERROR] intl extension이 로드되지 않았음';
[참조]
퓨니코드 : http://en.wikipedia.org/wiki/Punycode
intl 매뉴얼 : http://www.php.net/intl
PHP: intl - Manual
Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Errors Exceptions Generators References Explained Predefined Variables Predefined Exceptions Predefined Interface
www.php.net
출처: http://bloodguy.tistory.com/entry/PHP-한글-도메인-퓨니코드-변환-Punycode [Bloodguy]
'Program Language > PHP' 카테고리의 다른 글
convert 를 이용하여 pdf to jpg 로 변환 (0) | 2021.11.12 |
---|---|
PHP 부활절달걀(PHP Easter Egg) (0) | 2021.07.22 |
PHP setcookie 사용하기 (0) | 2021.06.04 |
PHP 설치 (0) | 2021.06.04 |
mysql pdo 커넥션 (0) | 2021.06.03 |