ASP MapPath 方法
http://www.w3school.com.cn/asp/met_mappath.asp
定义和用法
MapPath 方法可把指定的路径影射到服务器上相应的物理路径上。
注释:此方法不能用于 Session.OnEnd 和 Application.OnEnd 中。
实例
实例 1
举例,文件 test.asp 位于 C:\Inetpub\wwwroot\Script。
文件 Test.asp (位于 C:\Inetpub\wwwroot\Script) 包含下列代码:
<%
response.write(Server.MapPath("test.asp") & "<br />")
response.write(Server.MapPath("script/test.asp") & "<br />")
response.write(Server.MapPath("/script/test.asp") & "<br />")
response.write(Server.MapPath("\script") & "<br />")
response.write(Server.MapPath("/") & "<br />")
response.write(Server.MapPath("\") & "<br />")
%>
输出
c:\inetpub\wwwroot\script\test.asp
c:\inetpub\wwwroot\script\script\test.asp
c:\inetpub\wwwroot\script\test.asp
c:\inetpub\wwwroot\script
c:\inetpub\wwwroot
c:\inetpub\wwwroot
例子 2
如何使用一个相对路径来返回到达正在浏览器中查看的页面的相对物理路径:
<%
response.write(Server.MapPath("../"))
%>
或者
<%
response.write(Server.MapPath("..\"))
%>
相关文档:
5、纯ASP代码生成图表函数——立体饼图
<%dim total(7,1)
total(1,0)="中国经营报"
total(2,0)="招聘网"
total(3,0)="51Job"
total(4,0)="新民晚报"
total(5,0)="新闻晚报"
total(6,0)="南方周末"
total(7,0)="羊城晚报"
total(1,1)=200
total(2,1)=1200
total(3,1)=900
total(4,1)=600
total(5, ......
LBound() 函数: 返回指定的数组维可用的最小下标。
UBound() 函数: 返回指定的数组维可用的最大下标。
InStr([start, ]string1, string2[, compare]) 返回字符或字符串在另一个字符串中第一次出现的位置
InStrRev()函数 返回某字符串在另一个字符串中最后出现的位置
CDate() 函数可把一个合法的日期和时间表达式转换为 ......
1、在网站目录下新建一个文本:txtcounter.txt 在文本填写1或其他识字
2、新建一asp文件:count.asp,加入以下代码:
<%
CountFile=Server.MapPath("txtcounter.txt")
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
Set Out=FileObject.OpenTextFile(CountF ......
<style type="text/css">
.container, .container *{margin:0; padding:0;}
.container{width:325px; height:287px; overflow:hidden;position:relative; margin-left:5px; margin-top:6px;}
.slider{position:absolute;}
.slider li{ list-style:none;display:inline;}
.slider img{ width:325px; height:287p ......
大家有碰到过要想取一字符串里的某些值而无从下手?有没有觉得看书或教材对split的写法糊里糊涂……如果有此疑问的话,请看下面我对例子的解释,相信您会对这个有一定的了解。
我先介绍一下Split函数的用法:
返回值数组 = Split("字符串","分割符")
假设变量strURL保存着URL值,如strURL = "ftp://username ......