2016-07-04 2 views
0
if(!empty($maintenance_options['disable'])) { 
    $currentDate = date("Y-m-d H:i:s", strtotime(date("Y-m-d") . date("H:i:s"))); 
    $nodate = $maintenance_options['disable'], strtotime(date("Y-m-d") . date("H:i:s")); 

    if($currentDate > $nodate) { 
     echo 'if'; 
    } else { 
     echo 'else'; 
    } 
} 

:PHP의 strtotime으로 문제를 일으키는 원인이 오류 나는 이상한 오류가

Parse error: syntax error, unexpected ',' on line 53

라인 (53)

$nodate = $maintenance_options['disable'], strtotime(date("Y-m-d") . date("H:i:s")); 

하지만 그 선 괜찮을 것입니까? 그게 뭐가 잘못 됐어?

+0

해당 줄은 함수 호출을위한 것입니까? 세미콜론 앞에 추가로 닫는 괄호가 있습니다. –

+0

날짜 ("Y-m-d") 란 무엇입니까? 날짜 ("H : i : s")가 있어야하나요? date ("H : i : s")) – Nick

+0

@ EduardoGalván "닫는 괄호"는 무엇일까? 현재 시간을 원하면 strtotime 대신 date ("Y-m-d" 그들은 모두 일치합니다 –

답변

0

질문이 약간 이해하기 어려웠지만, 나는 무엇이 요청되는지 알고 있다고 생각합니다. $ currentDate는 현재 PHP 시간이어야하고 $ nodate는 $ maintenance_options [ 'disable']의 시간 값으로 설정되어야합니다. 이것이 사실이라면 다음 코드가 작동해야합니다.

$currentDate = time(); 
$nodate = strtotime($maintenance_options['disable']); 
+0

입니다. 고맙습니다. 나는 너무 어렵다고 생각했다. –

관련 문제