首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

curl_unescape

(PHP 5 >= 5.5.0, PHP 7)

curl_unescape - 解码给定的URL编码的字符串

描述

代码语言:javascript
复制
string curl_unescape ( resource $ch , string $str )

该函数解码给定的URL编码的字符串。

参数

ch

由curl_init()返回的cURL句柄。

str

要编码的URL编码字符串。

返回值

返回解码的字符串或失败返回FALSE。

例子

Example #1 curl_escape() example

代码语言:javascript
复制
<?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 →

扫码关注腾讯云开发者

领取腾讯云代金券