(PHP 5 >= 5.5.0, PHP 7)
curl_unescape — 锟斤拷锟斤拷锟斤拷锟斤拷锟� URL 锟斤拷锟斤拷锟斤拷址锟斤拷锟�
$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($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);
?>
Note:
curl_unescape() 锟斤拷锟结将锟接猴拷 (+) 锟斤拷锟斤拷煽崭瘛6锟� urldecode() 锟结。