我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

检查网址是否包含http://或https:// [复制]

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

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

you can use parse_url

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

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

Maybe this could help

$_SERVER['SERVER_PROTOCOL'];
if (substr($string, 0, 7) == "http://")
    $res = "http";

if (substr($string, 0, 8) == "https://")
    $res = "https";

近期文章

  • Google通讯录API - 选择活动数据
  • PHP:是否有正在使用的类实例?
  • WSDL和SOAP:使用方法返回对象
  • Zend Db Table Abstract Manipulate select()
  • 将键添加到现有(或非)数组
  • 什么是PHP开发的最佳ide? [关闭]
  • 从字符串中提取数字(4个位置)
  • 如何使用其他模型跟踪模型?
  • PHP Exec()使用sed给出了奇怪的结果
  • PHP / MySQL / jQuery - 将textarea设置为新的div
  • 使用PHP监控外部ftp上传
  • 使用Prototype显示多个页面
  • imap_num_msg未检测到转发的电子邮件
  • 在Yii框架中使用XML作为数据源
  • 将Bangla语言插入Mysql数据库
  • 通过引用传递或返回PHP中的数组? [关闭]
  • 电子邮件阵列上的PHP OOP过滤器验证
  • 如何在Zend框架中优化模型?
  • 重定向到主机的错误页面
  • wordpress手机主题删除短代码

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华