'my error2: ' 正确记录并且函数 'GetExactTeacherAppViaId_contr' 正常工作。但问题是只要此行存在,Ajax 响应就无法正常工作: $teachers = $teacher->GetExactTeacherAppViaId_contr($dbh, $teacherId);
只有当我删除它时,响应才能正常工作,但是日志或其他任何地方都没有错误。
if (substr($userId, 0, 1) == 't') {
try {
$userIs = 'teacher';
$teacherId = $userId;
$teachers = $teacher->GetExactTeacherAppViaId_contr($dbh, $teacherId);
error_log("my error2 :" . $teachers[0]['Email']);
echo json_encode(array(
'test' => $userIs,
'userIs' => $userIs,
'teacherFirstName' => $teachers[0]['FirstName'],
'teacherLastName' => $teachers[0]['LastName'],
'teacherEmail' => $teachers[0]['Email'],
'teacherStatus' => $teachers[0]['Status'],
'suggestedUserName' => $teachers[0]['FirstName'] . ' ' . $teachers[0]['LastName']
));
} catch (Exception $e) {
// Handle the exception and log or display an error message
error_log("Exception: " . $e->getMessage());
}
}
我尝试编写错误日志并简化请求和响应,但也是同样的问题。