curl_unescape
(PHP 5 >= 5.5.0, PHP 7)
curl_unescape - 解码给定的URL编码的字符串
描述
string curl_unescape ( resource $ch , string $str )
该函数解码给定的URL编码的字符串。
参数
ch
由curl_init()返回的cURL句柄。
str
要编码的URL编码字符串。
返回值
返回解码的字符串或失败返回FALSE。
例子
Example #1 curl_escape() example
<?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_strerror
curl_version →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com