Latest web development tutorials

คุณสมบัติ parentFolder ASP

อ้างอิงวัตถุโฟลเดอร์ อ้างอิงวัตถุ Complete โฟลเดอร์

parentFolder คุณสมบัติถูกนำมาใช้เพื่อกลับไปยังวัตถุโฟลเดอร์หลักสำหรับไฟล์ที่ระบุหรือโฟลเดอร์

ไวยากรณ์

FileObject.ParentFolder

FolderObject.ParentFolder

สำหรับวัตถุเช่นไฟล์

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\asp\test\test.asp")
Response.Write("The file test.asp is in the folder: ")
Response.Write(f.ParentFolder)
set f=nothing
set fs=nothing
%>

输出:

The file test.asp is in the folder: C:\asp\test

สำหรับวัตถุเช่นโฟลเดอร์

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\asp\test")
Response.Write("The folder test is in the folder: ")
Response.Write(fo.ParentFolder)
set fo=nothing
set fs=nothing
%>

输出:

The folder test is in the folder: C:\asp


อ้างอิงวัตถุโฟลเดอร์ อ้างอิงวัตถุ Complete โฟลเดอร์