cURL curl_unescape
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
curl_unescape — 주어진 URL 인코딩된 문자열을 디코딩합니다.
설명
curl_unescape(CurlHandle $handle
, string $string
): string|false
이 함수는 주어진 URL 인코딩된 문자열을 디코딩합니다.
매개변수
handle
- curl_init()에서 반환된 cURL 핸들입니다.
string
- 디코딩할 URL 인코딩된 문자열입니다.
반환 값
디코딩된 문자열을 반환하거나 실패 시 false
를 반환합니다.
변경 로그
버전 | 설명 |
---|---|
8.0.0 | handle 은 이제 CurlHandle 인스턴스를 예상합니다. 이전에는 리소스가 필요했습니다. |
Examples
예제 #1 curl_escape() 예제
<?php
// Create a curl handle
$ch = curl_init('http://example.com/redirect.php');
// Send HTTP request and follow redirections
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_exec($ch);
// Get the last effective URL
$effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
// ie. "http://example.com/show_location.php?loc=M%C3%BCnchen"
// Decode the URL
$effective_url_decoded = curl_unescape($ch, $effective_url);
// "http://example.com/show_location.php?loc=München"
// Close the handle
curl_close($ch);
?>
메모
메모: curl_unescape()는 더하기 기호(+)를 공백으로 디코딩하지 않습니다. urldecode() 합니다.
기타
- curl_escape() - URL은 주어진 문자열을 인코딩합니다
- urlencode() - URL 인코딩 문자열
- urldecode() - URL 인코딩된 문자열 디코딩
- rawurlencode() - RFC 3986에 따른 URL 인코딩
- rawurldecode() - URL 인코딩 문자열 디코딩