PHP encodeURI()

Jmnote bot (토론 | 기여)님의 2020년 11월 2일 (월) 02:34 판 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

function encodeURI($url) {
	return strtr(rawurlencode($url),[
		'%2D'=>'-','%5F'=>'_','%2E'=>'.','%21'=>'!','%7E'=>'~',
		'%2A'=>'*','%27'=>"'",'%28'=>'(','%29'=>')','%3B'=>';',
		'%2C'=>',','%2F'=>'/','%3F'=>'?','%3A'=>':','%40'=>'@',
		'%26'=>'&','%3D'=>'=','%2B'=>'+','%24'=>'$','%23'=>'#']);
}
var_dump( encodeURI("?") );
var_dump( encodeURI("http://www.Not a URL.com") );
var_dump( encodeURI('https://example.com/?x=안녕') );
# string(1) "?"
# string(28) "http://www.Not%20a%20URL.com"
# string(41) "https://example.com/?x=%EC%95%88%EB%85%95"

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}