欢迎来到科站长!

编程10000问

当前位置: 主页 > 网络编程 > 编程10000问

如何判断URL格式是否符合规范?

时间:2024-08-02 19:44:43|栏目:编程10000问|点击:

<%
 function checkisUrl(tmpString)

      dim c,i
      checkisUrl = true
      tmpString=Lcase(trim(tmpString))
      if left(tmpString,7)<>"http://" then tmpString="http://"&tmpString
      for i = 8 to Len(checkisUrl)
            c = Lcase(Mid(tmpString, i, 1))
            if InStr("abcdefghijklmnopqrstuvwxyz_-./\", c) <= 0 and not IsNumeric(c) then
                  checkisUrl = false
                  exit function
            end if
      next
      if Left(tmpString, 1) = "." or Right(tmpString, 1) = "." then
            checkisUrl = false
            exit function
      end if
      if InStr(tmpString, ".") <= 0 then
            checkisUrl = false
            response.Write "f3"
            exit function
      end if
      if InStr(checkisUrl, "..") > 0 then
            checkisUrl = false
      end if

end function
%>
<%

if checkisUrl(request("u"))=true then
      %>
恭喜,你的URL通过!
<%
else
      %>
对不起,你的URL不合乎规范,请重新检查!
<%end if%>

上一篇:如何计算下载一个文件需要多长时间?

栏    目:编程10000问

下一篇:如何取得服务器上的用户组列表?

本文标题:如何判断URL格式是否符合规范?

本文地址:https://www.fushidao.cc/wangluobiancheng/582.html

广告投放 | 联系我们 | 版权申明

申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:1205677645 | 邮箱:1205677645@qq.com

Copyright © 2018-2024 科站长 版权所有冀ICP备14023439号