PHP正则匹配网址

/**
     * @param $url 网址
     * @return bool
     */
    public static function checkUrl($url){
        $pattern="/^(http|https):\/\/.*$/i";
        if(preg_match($pattern,$url)){
            return true;
        }else{
            return false;
        }
    }
posted @ 2019-12-02 19:25  TBHacker  阅读(2851)  评论(0编辑  收藏  举报