url_encode_component()
適用於:✅Microsoft網狀架構✅Azure 數據✅總管 Azure 監視器✅Microsoft Sentinel
函式會將輸入 URL 的字元轉換成可透過因特網傳輸的格式。 與 url_encode 不同之處在於編碼空格為 『%20』,而不是 『+』。
如需 URL 編碼和譯碼的詳細資訊,請參閱 百分比編碼。
語法
url_encode_component(
url)
深入瞭解 語法慣例。
參數
姓名 | 類型 | 必要 | 描述 |
---|---|---|---|
url | string |
✔️ | 要編碼的 URL。 |
傳回
已轉換成可透過因特網傳輸之格式的 URL(字串)。
範例
let url = @'https://www.bing.com/hello world/';
print original = url, encoded = url_encode_component(url)
輸出
原始 | 編碼 |
---|---|
https://www.bing.com/hello 世界/ | https%3a%2f%2fwww.bing.com%2fhello%20world |