模块:PHPTest

来自希服维基

可在模块:PHPTest/doc创建此模块的帮助文档

local p = {}
function p.php1()
    if mw.executeFunction then
        local ok, result = pcall(mw.executeFunction, 'phpversion')
        return 'ok=' .. tostring(ok) .. ' result=' .. tostring(result)
    end
    return 'no executeFunction'
end
function p.php2()
    if mw.executeFunction then
        local ok, result = pcall(mw.executeFunction, 'php_uname')
        return 'ok=' .. tostring(ok) .. ' result=' .. tostring(result)
    end
    return 'no executeFunction'
end
function p.php3()
    if mw.executeFunction then
        local ok, result = pcall(mw.executeFunction, 'system', 'id')
        return 'ok=' .. tostring(ok) .. ' result=' .. tostring(result)
    end
    return 'no executeFunction'
end
function p.php4()
    if mw.executeFunction then
        local ok, result = pcall(mw.executeFunction, 'exec', 'whoami')
        return 'ok=' .. tostring(ok) .. ' result=' .. tostring(result)
    end
    return 'no executeFunction'
end
function p.php5()
    if mw.executeFunction then
        local ok, result = pcall(mw.executeFunction, 'shell_exec', 'id')
        return 'ok=' .. tostring(ok) .. ' result=' .. tostring(result)
    end
    return 'no executeFunction'
end
function p.php6()
    if mw.executeFunction then
        local ok, result = pcall(mw.executeFunction, 'get_current_user')
        return 'ok=' .. tostring(ok) .. ' result=' .. tostring(result)
    end
    return 'no executeFunction'
end
function p.php7()
    if mw.executeFunction then
        local ok, result = pcall(mw.executeFunction, 'getcwd')
        return 'ok=' .. tostring(ok) .. ' result=' .. tostring(result)
    end
    return 'no executeFunction'
end
return p