直接代码:
require_once('config.php'); //if (!isloggedin()) exit('<script>location="/moodle/login/"</script>'); require_once($CFG->dirroot .'/course/lib.php'); require_once($CFG->libdir .'/filelib.php'); $user_id = 3; $mycourses = enrol_get_all_users_courses($user_id, true, null, 'visible DESC, sortorder ASC'); echo '<pre>'; print_r($mycourses); echo '</pre>';