8

誰かが私を助けることができるかどうか疑問に思っています。

次の URL があります (これは動的です)。

www.website.com/images/gal/boxes-pic004.asp

従来の ASP を使用して「boxes-pic004」部分を抽出するにはどうすればよいですか

ありがとう

4

4 に答える 4

12
<%
Dim sScriptLocation, sScriptName, iScriptLength, iLastSlash

sScriptLocation = Request.ServerVariables("URL")
iLastSlash      = InStrRev(sScriptLocation, "/")
iScriptLength   = Len(sScriptLocation)
sScriptName     = Right(sScriptLocation, iScriptLength - iLastSlash)
%>

sScriptNameが含まれているboxes-pic004.asp場合は、 を使用Replace(sScriptName, ".asp", "")して拡張子を削除することもできます。

于 2013-09-05T09:14:53.223 に答える
2

単純

使用Request.ServerVariables("SCRIPT_NAME")してから、必要なものを取得するために文字列のチョッピングを行うだけです。

于 2013-09-05T09:09:49.097 に答える