일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- httpd.conf 보안 설정
- 비밀번호검증정규식
- PHP 구글 OTP 인증
- bootstrap
- wkhtmltopdf 실행 오류
- svn 충돌 해결 resolved
- 부트스트랩4 세로 중앙 정렬
- mariadb upgrade
- 비밀번호정규식
- 아파치 웹 서버의 정보 숨기기
- 우분투 mysql 비밀번호 없이 로그인 될때
- PHP 정규식 예제
- mysql root 비밀번호 변경
- (using password: YES)" when trying to connect
- libxrender1
- 파라미터 & 오류
- html pdf 변환
- usb efi 시스템 파티션 삭제
- mysqldump: Got error: 1045
- JQuery checkbox 컨트롤
- apache mod rewrite
- bootstrap modal
- PHP 구글 OTP 연동
- php 배열제거
- 자바스크립트비밀번호검증
- 구글 OTP 인증
- svn 충돌 해결 resolve
- modsecurity 설치
- javascript
- group_concat 구분자
- 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 |