亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

PHP 菜鳥教程

PHP 高級教程

PHP & MySQL

PHP 參考手冊

PHP curl_escape() 函數(shù)用法及示例

PHP CURL參考手冊

(PHP 5 >= 5.5.0)

curl_escape — 對給定的字符串進(jìn)行URL編碼。

語法

string curl_escape ( resource $ch , string $str )

該函數(shù)對給定的字符串進(jìn)行URL編碼。

參數(shù)

ch

由 curl_init() 返回的 CURL 句柄。

str

編碼字符串

返回值

返回編碼字符串,或者在失敗時返回 FALSE。

在線示例

<?php
// 創(chuàng)建一個CURL句柄
$ch = curl_init();
// 編碼GET參數(shù)
$location = curl_escape($ch, 'Hofbr?uhaus / München');
// Result: Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen
// 比較編碼后的URL
$url = "http://example.com/add_location.php?location={$location}";
// Result: http://example.com/add_location.php?location=Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen
// 發(fā)送HTTP請求并關(guān)閉句柄
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
?>

PHP CURL參考手冊