gpt4 book ai didi

vbscript - Server.Execute 使用固定路径

转载 作者:行者123 更新时间:2023-12-04 10:15:13 24 4
gpt4 key购买 nike

我正在尝试实现 server.execute()通过来自虚拟函数库 ( <!-- #include virtual="lib/functions.asp"--> ) 的包含,我可以从系统中的任何子文件夹调用它。我正在尝试实现一个新功能,该功能应该存在于我们系统中的所有页面上,并且将其手动添加到每个页面几乎是不可行的。而且我需要以一种不会干扰任何页面上的代码的方式实现它,这就是为什么我将其作为 server.execute() 来执行。在我知道已经存在于系统中的任何地方的虚拟库中。

例如:

'location of routine.asp = https://example.com/admin/routine/routine.asp

Server.Execute("routine/routine.asp")
'Will work if I add the virtual lib from an ASP-page in the admin subfolder, but not if I call it from another subfolder

Server.Execute("https://example.com/admin/routine/routine.asp")
'Does not work, because server.execute can't handle that kind of fixed path

documentation明确指出不允许使用冒号和双斜杠,但我不知道如何确保文件的执行无论在系统中的哪个位置调用它。

问题:我该如何制作 server.execute(path)的路径处理固定路径,还是动态更改路径以确保我始终可以正确定位文件?

最佳答案

如果您想使用绝对路径,请确保您使用的是绝对路径(从根目录开始的完整路径)。

认为您只需要明确指定绝对路径;

Server.Execute("/admin/routine/routine.asp")

关于vbscript - Server.Execute 使用固定路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61094608/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com