array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.curl-unescape.php', 1 => 'curl_unescape', ), 'up' => array ( 0 => 'ref.curl.php', 1 => 'cURL 関数', ), 'prev' => array ( 0 => 'function.curl-strerror.php', 1 => 'curl_strerror', ), 'next' => array ( 0 => 'function.curl_upkeep.php', 1 => 'curl_upkeep', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/curl/functions/curl-unescape.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
curl_unescape — URL エンコードされた文字列をデコードする
handle
curl_init() が返す cURL ハンドル。
string
デコード対象の文字列。
デコードした文字列を返します。失敗した場合に false
を返します。
バージョン | 説明 |
---|---|
8.0.0 |
handle は CurlHandle クラスのインスタンスを期待するようになりました。
これより前のバージョンでは、resource を期待していました。
|
例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"
// URL をデコードします
$effective_url_decoded = curl_unescape($ch, $effective_url);
// "http://example.com/show_location.php?loc=München"
// ハンドルを閉じます
curl_close($ch);
?>
注意:
curl_unescape() は、プラス記号 (+) をスペースに変換しません。 urldecode() は、この変換をします。