检查网址是否包含http://或https:// [英] Check whether url contains http:// or https://

查看:123
本文介绍了检查网址是否包含http://或https://的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
检查网址是否包含http或https

Possible Duplicate:
Check if the url is contains the http or https

使用PHP和正则表达式在开始时确定给定URL包含http://还是https://的代码是什么?

What is the code to figure out whether the given URL contains http:// or https:// at the beginning using PHP and regular expressions?

推荐答案

,您可以使用 parse_url

<?php
$url = parse_url('https://example.org');

if($url['scheme'] == 'https'){
   // is https;
}
?>

这篇关于检查网址是否包含http://或https://的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆