脚本宝典收集整理的这篇文章主要介绍了PHP – 将页面重定向到没有协议的URL?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个网站www.example.COM.它正在移动浏览器上打开,我必须重定向到某个东西://在一个动作触发重定向后.
无论我怎么努力,我都无法重定向到某些东西://,当我这样做时:
<?PHP header('Location:something://'); ?>我得到的是:http://www.example.com/something://. 我一直在尝试使用JS(location.replace.href,location.replace等),但也没有运气. 如何强制URL改变我想要的方式?
其中absoluteURI在RFC 2396中指定.
absoluteURI = scheme ":" ( hier_part | opaque_part ) relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ] hier_part = ( net_path | abs_path ) [ "?" query ] opaque_part = uric_no_slash *uric uric_no_slash = unreserved | escaPEd | ";" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," net_path = "//" authorITy [ abs_path ] abs_path = "/" path_segments authority = server | reg_name reg_name = 1*( unreserved | escaped | "$" | "," | ";" | ":" | "@" | "&" | "=" | "+" ) server = [ [ userinfo "@" ] hostport ] userinfo = *( unreserved | escaped | ";" | ":" | "&" | "=" | "+" | "$" | "," ) hostport = host [ ":" port ] host = hostname | ipv4address hostname = *( domainlabel "." ) toplabel [ "." ] domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum toplabel = alpha | alpha *( alphanum | "-" ) alphanum Ipv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit port = *digit
由此,如果您使用的是://协议,则需要指定权限部分 – 斜杠不能是字符串的最后部分,例如东西://例子
以上是脚本宝典为你收集整理的PHP – 将页面重定向到没有协议的URL?全部内容,希望文章能够帮你解决PHP – 将页面重定向到没有协议的URL?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。