curl_unescape
(PHP 5 >= 5.5.0, PHP 7)
curl_unescape — URL エンコードされた文字列をデコードする
説明
curl_unescape
( CurlHandle $handle
, string $string
) : string|false
この関数は、URL エンコードされた文字列をデコードします。
返り値
デコードした文字列を返します。失敗した場合に false
を返します。
例
例1 curl_escape() の例
<?php// curl ハンドルを作ります$ch = curl_init('http://example.com/redirect.php');// HTTP リクエストを送信し、リダイレクトにしたがいますcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_exec($ch);// 直近の実効 URL を取得します$effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);// "http://example.com/show_location.php?loc=M%C3%BCnchen%22// URL をデコードします$effective_url_decoded = curl_unescape($ch, $effective_url);// "http://example.com/show_location.php?loc=München%22// ハンドルを閉じますcurl_close($ch);?>
注意
注意:
curl_unescape() は、プラス記号 (+) をスペースに変換しません。 urldecode() は、この変換をします。
参考
- curl_escape() - 指定した文字列を URL エンコードする
- urlencode() - 文字列を URL エンコードする
- urldecode() - URL エンコードされた文字列をデコードする
- rawurlencode() - RFC 3986 に基づき URL エンコードを行う
- rawurldecode() - URL エンコードされた文字列をデコードする