Php 与函数_exists()等价,并在ASP中调用_user_func()

Php 与函数_exists()等价,并在ASP中调用_user_func(),php,asp-classic,Php,Asp Classic,ASP中是否存在与PHP中的function\u exists()等效的函数 类似于call\u user\u func()?您可以通过一个技巧来实现这一点: public function getFunction(functionName) set getFunction = nothing on error resume next set getFunction = getRef(functionName) on error goto 0 end functi

ASP中是否存在与PHP中的
function\u exists()
等效的函数


类似于
call\u user\u func()

您可以通过一个技巧来实现这一点:

public function getFunction(functionName)
    set getFunction = nothing
    on error resume next
    set getFunction = getRef(functionName)
    on error goto 0
end function

dim func : set func = getFunction("myFunction")
if not func is nothing then
    ' call "myFunction"
    func
else
    ' "myFunction" does not exist
end if

我认为对于动态函数调用,您可能必须求助于
eval
。据我所知,无法确定函数是否存在。这些东西可能都是在线的,所以当你提问时,值得你先花几分钟进行搜索,这会节省你一些时间。Halfer–它是在线的,因为人们已经问过了–这不是一个坏问题,除了ASP。