url类

package
v0.0.0-...-2910145 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

包gurl提供了用于URL处理的有用API。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func X生成URL

func X生成URL(查询参数 url.Values) string

BuildQuery 生成 URL 编码的查询字符串。 参考:http://php.net/manual/en/function.http-build-query.php.

func X编码

func X编码(文本 string) string

Encode 对字符串进行转义,以便它可以安全地放置在 URL 查询参数内。

func X编码RFC3986

func X编码RFC3986(文本 string) string

RawEncode 对给定的字符串进行编码, 根据 RFC 3986 进行 URL 编码。 参见 http://php.net/manual/en/function.rawurlencode.php.

func X解析

func X解析(文本 string, 类型标签 int) (map[string]string, error)

ParseURL 解析一个URL并返回其组成部分。 参数: -1:所有部分;1:方案(如http);2:主机名;4:端口;8:用户名;16:密码;32:路径;64:查询字符串;128:片段(锚点)。 参考:http://php.net/manual/en/function.parse-url.php.

func X解码

func X解码(文本 string) (string, error)

Decode完成与Encode相反的转换操作, 将形式为"%AB"的每个3字节编码子串转化为十六进制解码后的字节0xAB。 如果存在百分号(%)后跟随的不是两个十六进制数字,则返回错误。

func X解码RFC3986

func X解码RFC3986(文本 string) (string, error)

RawDecode用于解码给定的字符串 解码URL编码过的字符串。 参考:http://php.net/manual/en/function.rawurldecode.php.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL