일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 숫자 3자리(천단위) 마다 콤마 찍기
- html pdf 변환
- bootstrap
- PHP 정규식 예제
- apple push notification service (apns) is changing
- PHP 구글 OTP 연동
- bootstrap modal
- (using password: YES)" when trying to connect
- 우분투 mysql 비밀번호 없이 로그인 될때
- 윈도우 mod_security2
- mysql root 비밀번호 변경
- php 배열제거
- 비밀번호검증정규식
- sha-2 root
- 파라미터 & 오류
- mysqldump: Got error: 1045
- group_concat 구분자
- 아파치 웹 서버의 정보 숨기기
- usb efi 시스템 파티션 삭제
- PHP 구글 OTP 인증
- 비밀번호정규식
- 자바스크립트비밀번호검증
- httpd.conf 보안 설정
- 윈도우 환경 아파치 mod_security2 설치
- mod_security2 설치
- modsecurity 설치
- php 이미지 url 검증 함수
- javascript
- mariadb upgrade
- 구글 OTP 인증
- 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 |