📞 09318539889 📧 yxp@gansuwangzhan.cn

检查 URL 中是否包含 http 或 https

作者:杨锦龙时间:2026-06-24点击量:0次
/**
 * 检查 URL 中是否包含 http 或 https
 *
 * @param string $url 要检查的 URL 字符串
 * @return bool 如果包含 http 或 https 返回 true,否则返回 false
 */
public function containsHttpOrHttps($url) {
    // 使用正则表达式检查是否以 http:// 或 https:// 开头
    return preg_match('/^https?:\/\//i', $url) === 1;
}