本网站由以下捐款支持:OEIS基金会.

模板:~URL

来自OeisWiki
跳转到:航行搜索

alt=此模板正在构建中。。。
该模板正在施工中。            

请不要使用此未完成和/或仍不可靠模板。            


这个{{~ URL}}helper函数模板(其目的是从HTTP/HTTPS URL提取组件)由{{网址}}OEIS Wiki实用程序模板。

网址

通用URL采用以下形式[1]

方案:特定于方案的部分

常见的互联网架构特定部分语法是

//用户:密码@host:端口/路径

HTTP/HTTPS URL采用以下形式

scheme://server.domain:port/path?query_string#fragment_id

哪里

  • 这个方案(通常称为协议)name(http或https),后跟冒号(:),
  • 两个斜杠(//),然后
    • 服务器name(例如www,…)后跟一个点(.),然后是领域,或
    • 服务器IP地址后跟一个点(.),然后是领域IP地址,
  • 可选:冒号(:)后跟港口数字(http默认为80,https默认为443),然后
  • 这个路径要获取的资源或要运行的程序,然后
  • 对于通用网关接口(CGI)脚本等程序,问号(?)后面跟着查询字符串(搜索部分)、和
  • 可选:哈希符号(#)后跟碎片ID(锚ID).

用法

要从URL提取组件,请使用

{{~ URL|未编码的URL|URL组件}}

哪里URL组件是其中之一

  • 协议方案
  • 方案特定部分
  • 主办服务器域
  • 服务器
  • 领域
  • 港口
  • 路径
  • 查询字符串搜索部分
  • 碎片ID锚ID

示例

输入无效的示例

{{~ URL|}}

产量

~URL错误:第一个参数(未编码的URL)必须为非空。 
{{~ URL|http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FUniform_resource_locator%23Absolute_and_relative_URLs}}

产量

~URL错误:第一个参数(未编码的URL)必须为未编码的. 

输入有效的示例

方案提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|协议}}

产量

http协议
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|方案}}

产量

http协议
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|方案}}

产量

https(https)

特定于模式的部分提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|方案特定部分}}

产量

en.wikipedia.org/wiki/Uniform_resource_locator#绝对和相对URL
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|方案特定部分}}

产量

en.wikipedia.org:80/wiki/Uniform_resource_locator#Absolute_and_relative_URLs
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|方案特定部分}}

产量

www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

主机示例:端口提取

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|服务器.域:端口}}

产量

en.wikipedia.org网站
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|主机:端口}}

产量

en.wikipedia.org:80
{{~ URL|https://www.google.ca/search?q=斐波那契+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|主机:端口}}

产量

网址:www.google.ca

宿主提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|主机}}

产量

en.wikipedia.org网站
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|服务器.域}}

产量

en.wikipedia.org网站
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|主机}}

产量

网址:www.google.ca

服务器提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|服务器}}

产量

英语
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|服务器}}

产量

英语
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|服务器}}

产量

网址:www

域提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|域}}

产量

维基百科.org
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|域}}

产量

维基百科.org
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|域}}

产量

谷歌.ca

端口提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|端口}}

产量

 
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|端口}}

产量

80 
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|端口}}

产量

 

路径或CGI脚本提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|路径}}

产量

wiki/Uniform_resource_locator
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|路径}}

产量

wiki/Uniform_resource_locator
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|路径}}

产量

搜索

查询字符串提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|查询字符串}}

产量

 
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|查询字符串}}

产量

 
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|查询字符串}}

产量

q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

片段ID提取示例

{{~ URL|http://en.wikipedia.org/wiki/Uniform_resource_locator#Absolute_and_relative_URLs|片段ID}}

产量

绝对_和相对_ URL
{{~ URL|http://en.wikipedia.org/80/wiki/Uniform_resource_locator#Absolute_and_relative_URL|片段ID}}

产量

绝对_和相对_ URL
{{~ URL|https://www.google.ca/search?q=Fibonacci+多项式+三角形&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a|片段ID}}

产量

 

代码




另请参见

笔记

  1. T.Berners-Lee、L.Masinter、M.McCahill、,统一资源定位器(URL).