여러 가지 방법으로이 동일한 코딩을 시도했지만 그 중 아무 것도 작동하지 않았습니다.예기치 않은 경우?
public function getCalendarById($calendarId)
{
$calendarsList = $this->getCalendarsList();
if($calendarId == "1") {
return $this->getMergedCalendars();
} else {
return (array_key_exists($calendarId, $calendarsList) ? $calendarsList[$calendarId] : null);
} else {//******** error here ***********
return (array_key_exists($calendarId, $calendarsList) ? $this->holidayrize($calendarId) : null);
}
}
주석 처리 된 줄에 오류가 발생합니다. 그것은 예기치 않은 T_ELSE를 말합니다
어떤 아이디어?
첫 번째 else는 else if로 지정됩니다. –
if (조건) ... else if (다른 조건) ... else – rosco
'elseif'와 조건이 필요합니다. –