检查URL方案是HTTP还是HTTPS [英] Check whether the URL scheme is HTTP or HTTPS
本文介绍了检查URL方案是HTTP还是HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码将 http://
添加到网址。
I'm using the following code to add http://
to the URL.
(substr(strtolower($url), 0, 7) == 'http://'?"":"http://").$url
但如何检查原始网址是否包含 https
?我不想使用 OR 子句。
but how can I check whether the original URL contains https
? I don't want to use an OR clause.
推荐答案
preg_match("@^https?://@", $url)
这篇关于检查URL方案是HTTP还是HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文