?
このドキュメントでは、 php中國語ネットマニュアル リリース
Server 對象用于訪問有關(guān)服務(wù)器的屬性和方法。
ASP Server 對象用于訪問有關(guān)服務(wù)器的屬性和方法。其屬性和方法描述如下:
屬性 | 描述 |
---|---|
ScriptTimeout | 設(shè)置或返回在一段腳本終止前它所能運行時間(秒)的最大值。 |
方法 | 描述 |
---|---|
CreateObject | 創(chuàng)建對象的實例。 |
Execute | 從另一個 ASP 文件中執(zhí)行一個 ASP 文件。 |
GetLastError() | 返回可描述已發(fā)生錯誤狀態(tài)的 ASPError 對象。 |
HTMLEncode | 把 HTML 編碼應(yīng)用到某個指定的字符串。 |
MapPath | 把一個指定的路徑映射到一個物理路徑。 |
Transfer | 把一個 ASP 文件中創(chuàng)建的所有信息發(fā)送(傳輸)到另一個 ASP 文件。 |
URLEncode | 把 URL 編碼規(guī)則應(yīng)用到指定的字符串。 |
此文件最后被修改的時間是?
探測文件的最后修改時間。
<!DOCTYPE?html> <html> <body> <% Set?fs?=?Server.CreateObject("Scripting.FileSystemObject") Set?rs?=?fs.GetFile(Server.MapPath("demo_lastmodified.asp")) modified?=?rs.DateLastModified %> This?file?was?last?modified?on:?<%response.write(modified) Set?rs?=?Nothing Set?fs?=?Nothing %> </body> </html>
打開并讀取某個文本文件
打開文件 "Textfile.txt" 以供讀取。
<!DOCTYPE?html> <html> <body> <% Set?FS?=?Server.CreateObject("Scripting.FileSystemObject") Set?RS?=?FS.OpenTextFile(Server.MapPath("text")?&?"\TextFile.txt",1) While?not?rs.AtEndOfStream ??????Response.Write?RS.ReadLine ??????Response.Write("<br>") Wend? %> <p> <a?href="text/textfile.txt"><img?src="/images/btn_view_text.gif"></a> </p> </body> </html>
自制的點擊計數(shù)器
<% Set?FS=Server.CreateObject("Scripting.FileSystemObject") Set?RS=FS.OpenTextFile(Server.MapPath("counter.txt"),?1,?False) fcount=RS.ReadLine RS.Close fcount=fcount+1 'This?code?is?disabled?due?to?the?write?access?security?on?our?server: 'Set?RS=FS.OpenTextFile(Server.MapPath("counter.txt"),?2,?False) 'RS.Write?fcount 'RS.Close Set?RS=Nothing Set?FS=Nothing %> <!DOCTYPE?html> <html> <body> <p> This?page?has?been?visited?<%=fcount%>??times. </p> </body> </html>