Moodle auth插件-调用未定义的函数

时间:2018-09-04 12:01:35

标签: php moodle

我正在尝试创建自己的穆迪认证插件(/moodle/auth/manualspace/auth.php)。

我想在其中调用一个函数,但是在执行过程中会显示错误消息。

有人可以发光吗?

消息错误:

  

Exceção-调用未定义函数exibe_msg()

代码:

public function exibe_msg() {
   echo "
   <html>
   <title>Problem</title>
   <body>
   <h1>You're not allowed...</h2>
   </body>
   </html>";
}

function user_authenticated_hook($user, $username, $password)  {
    global $CFG;

    exibe_msg();

    require_logout();   

   exit(0);

}

预先感谢

罗伯托

2 个答案:

答案 0 :(得分:0)

您能告诉我们整个课程吗?

它必须看起来像这样https://github.com/catalyst/moodle-auth_basic/blob/master/auth.php

然后函数调用必须如下所示:

$this->exibe_msg();

答案 1 :(得分:0)

public function表示它在类内部而不是抽象的,因此您必须首先实例化您的类