curl_unescape

(PHP 5 >= 5.5.0, PHP 7)

curl_unescape锟斤拷锟斤拷锟斤拷锟斤拷锟� URL 锟斤拷锟斤拷锟斤拷址锟斤拷锟�

说锟斤拷

curl_unescape ( resource $ch , string $str ) : string

锟矫猴拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟� URL 锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟�

锟斤拷锟斤拷

ch

锟斤拷 curl_init() 锟斤拷锟截碉拷 cURL 锟斤拷锟斤拷锟�

str

锟斤拷要锟斤拷锟斤拷锟� URL 锟斤拷锟斤拷锟街凤拷锟斤拷

锟斤拷锟斤拷值

锟斤拷锟截斤拷锟斤拷锟斤拷锟街凤拷锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷

Example #1 curl_escape() 示锟斤拷

<?php
// 锟斤拷锟斤拷一锟斤拷 curl 锟斤拷锟�
$ch curl_init('http://example.com/redirect.php');

// 锟斤拷锟斤拷 HTTP 锟斤拷锟斤拷锟斤拷锟斤拷循锟截讹拷锟斤拷
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
curl_exec($ch);

// 锟斤拷取锟斤拷锟斤拷锟斤拷效 URL
$effective_url curl_getinfo($chCURLINFO_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);
?>

注锟斤拷

Note:

curl_unescape() 锟斤拷锟结将锟接猴拷 (+) 锟斤拷锟斤拷煽崭瘛6锟� urldecode() 锟结。

锟轿硷拷

  • curl_escape() - 使锟斤拷 URL 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷址锟斤拷锟�
  • urlencode() - 锟斤拷锟斤拷 URL 锟街凤拷锟斤拷
  • urldecode() - 锟斤拷锟斤拷锟窖憋拷锟斤拷锟� URL 锟街凤拷锟斤拷
  • rawurlencode() - 锟斤拷锟斤拷 RFC 3986 锟斤拷 URL 锟斤拷锟叫憋拷锟斤拷
  • rawurldecode() - 锟斤拷锟窖憋拷锟斤拷锟� URL 锟街凤拷锟斤拷锟斤拷锟叫斤拷锟斤拷