-
urlencode(), urldecode() 함수개발 관련/PHP 2011. 3. 24. 15:33
urlencode
(PHP 4, PHP 5)
urlencode — 문자열을 URL 인코드
header("Content-Type: text/html; charset=UTF-8"); $userinput= 'encodeing&&인코딩!'; echo urlencode($userinput)."
"; --> encodeing%26%26%EC%9D%B8%EC%BD%94%EB%94%A9%21 $useroutput= 'encodeing%26%26%EC%9D%B8%EC%BD%94%EB%94%A9%21'; echo urldecode($useroutput); --> encodeing&&인코딩!
참고사항
urlencode 같은 경우는 [0-9a-zA-z]등은 encode가 되지 않습니다.
한글 및 특수 문자만 인코딩 됩니다.
또한 urlencode는 파이어폭스에서는 작동을 하지 않습니다.
따라서 base64_encode()를 사용할 것을 권장합니다.
참고: http://kr.php.net/manual/kr/function.urlencode.php
'개발 관련 > PHP' 카테고리의 다른 글
substr_count() 함수 (0) 2011.05.12 join() (0) 2011.03.23 htmlentities (0) 2011.03.22 Date() 함수 (0) 2011.03.17 chr (0) 2011.03.14