我在elseif语句中有一个if / else语句导致以下问题"syntax error, unexpected '{'"
。以下是导致问题的代码:
$calendar = json_decode($calendarapi);
if(isset($calendar->id) && $calendar->status != 'cancelled'){
$returnvalues['id'] = $calendar->id;
$returnvalues['success'] = true;
return $returnvalues;
}
elseif($calendar->status == 'cancelled'){
$calendarapi = $this->GoogleCalendarAdd($request, $request, $calendarDescription, $startDateTime, $endDateTime);
$calendar = json_decode($calendarapi);
if(isset($calendar->id){ //Error Happens here
$basic['OldSchedule']->calendar_id = $calendar->id;
$basic['OldSchedule']->save();
$returnvalues['success'] = true;
return $returnvalues;
}else{
$returnvalues['success'] = false;
return $returnvalues;
}
}
我已经查看了几十次,但我无法弄清楚我哪里出错了。所有分号都应该是它们应该存在的位置。我的代码编辑器Atom表明if / else语句嵌套在elseif语句中,所以我没有可能导致错误的事情。
答案 0 :(得分:0)
elseif($calendar->status == 'cancelled'){
$calendarapi = $this->GoogleCalendarAdd($request, $request,
$calendarDescription, $startDateTime, $endDateTime);
$calendar = json_decode($calendarapi);
你最后错过了一个}