duancheng3042 2013-08-14 06:10
浏览 141

来自Moodle插件的调试信息

I am a newbie to Moodle. I am trying to create a local plug which would do tasks (sending email) automatically when user is enrolled / unenrolled.

While developing this plugin, I am trying to echo or print_r some information for debug and tracing purposes.

The code is as simple as

function perform_enrol($eventdata){
        echo 'Hello World';
        print_r($eventdata);
        return true;
}

However, when the code executes, I get the following error occurs:

> Syntax Error File:
> http://192.168.10.60/moodle/theme/yui_combo.php?3.9.1/build/simpleyui/simpleyui.js&3.9.1/build/loader/loader.js
> Line: 18541

When I comment out the echo and print_r , the code works fine. The same problem continues for print_object , debug or any other printing functions.

Is there a specific way to print from plugins. I have used these functions in core code in past and seems to work fine.

  • 写回答

2条回答 默认 最新

  • dongpao5658 2013-08-14 06:56
    关注

    This is not the issue with the debug message from the plugin. This is due to outputting a message before an Ajax request. Please check if there are any ajax request in the particular plugin or in Moodle default pages. There is no specific debug messages specific for plugins. You can use any php built in debug functions.

    Hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)