我在使用 PHP 进行 Google API 集成时遇到问题。
下面的代码将拉出这些类,但它会拉出所有类(ACTIVE、ARCHIVED等...)。我只想要活跃课程。
问题是当我添加 courseStates 参数时它说它不存在
$service = new Google_Service_Classroom($client);
$courses = '';
$optParams = array(
//none of these seem to work
//'courseStates' => 'ACTIVE',
//'courseState' => 'ACTIVE',
//'CourseStates' => 'ACTIVE',
'pageSize' => 50,
'studentId' => $user_email
);
$results = $service->courses->listCourses($optParams);
if (count($results->getCourses()) == 0) {
// print "No courses found.\n";
} else {
// print "Courses:\n";
foreach ($results->getCourses() as $course) {
$courses .= $course->getName()."<br />";//." ". $course->getId();
//printf("%s (%s)\n", $course->getName(), $course->getId());
}
}
该方法在这里,但显示的选项都不起作用 https://developers.google.com/classroom/reference/rest/v1/courses/list
扬帆大鱼
皈依舞
RISEBY