1.parse_url()
本函数解析一个 URL 并返回一个关联数组,包含在 URL 中出现的各种组成部分。 parse_url('http://username:password@hostname/path?arg=value#anchor');
以上例程会输出:
Array
(
[scheme] =>http
[host] =>hostname
[user] =>username
[pass] =>password
[path] =>/path
[query] =>arg=value
[fragment]=> anchor
)
2. urlencode()与urldecode()
两个函数分别用于编码 URL 字符串和解码已编码的 URL 字符串, 保证URL数据传递过程中字符的完整性和兼容性.