Moodle自定义身份验证方法插件中的其他字段


Additional fields in Moodle custom auth method plugin

我有一个自定义身份验证方法插件,我添加了一个自定义表单。该插件工作正常,但我需要在表单中添加另一个字段,并在user_login函数中获得提交的值

用户名:[用户名字段]密码:[密码字段]另一个文本:[附加文本字段]

现在在auth.php和中

function user_login($username, $password){
    ....
    ....
    ....
    //I want to be able to get the value of the submitted field (additional text field) here
}

我该怎么做?感谢您的帮助,谢谢!

我不会使用$_POST直接尝试

$fieldname = optional_param('field_name', null, PARAM_XXX);

$fieldname = required_param('field_name', PARAM_XXX);

其中,PARAM_XXX是您期望的值的类型。