내 서버는 함수가 지원되지 않기 때문에 오류를 계속 반환합니다. 젠드 최적화 도구가 PHP 5.3을 지원할 때까지 PHP 5.3으로 업그레이드 할 수 없다는 것을 최근에 알아 냈습니다. 현재 서버 관리자는 서버 환경에 대한 ZO의 안정 버전을 고수하고 싶습니다.PHP 5.3에서 PHP 5.2.17에 맞게 조정 된 코드
코드를 조정할 것을 권장 할 수 있습니까?
Fatal error: Call to undefined method DateTime::createfromformat()
이
코드입니다 :$today = date('l');
if($today == 'Wednesday'){
$min = date('d/m/Y', strtotime('0 days'));
$max = date('d/m/Y', strtotime('+6 days'));
}else if($today == 'Thursday'){
$min = date('d/m/Y', strtotime('-1 days'));
$max = date('d/m/Y', strtotime('+5 days'));
}else if($today == 'Friday'){
$min = date('d/m/Y', strtotime('-2 days'));
$max = date('d/m/Y', strtotime('+4 days'));
}else if($today == 'Saturday'){
$min = date('d/m/Y', strtotime('-3 days'));
$max = date('d/m/Y', strtotime('+3 days'));
}else if($today == 'Sunday'){
$min = date('d/m/Y', strtotime('-4 days'));
$max = date('d/m/Y', strtotime('+2 days'));
}else if($today == 'Monday'){
$min = date('d/m/Y', strtotime('-5 days'));
$max = date('d/m/Y', strtotime('+1 days'));
}else if($today == 'Tuesday'){
$min = date('d/m/Y', strtotime('-6 days'));
$max = date('d/m/Y', strtotime('0 days'));
}
// check database for necessary updates
$update = mysql_query("SELECT * FROM rent WHERE colour='#3C0'");
while($row_update = mysql_fetch_array($update)) {
$datetime_lower = DateTime::createFromFormat('d/m/Y', $min);
$datetime_upper = DateTime::createFromFormat('d/m/Y', $max);
$datetime_compare = DateTime::createFromFormat('d/m/Y g:i a', $row_update['pDate']);
if ($datetime_lower < $datetime_compare && $datetime_upper > $datetime_compare) {
// date is between do nothing
} else {
// date is not between so update
$update_result = mysql_query("UPDATE rent SET colour='#F0F0F0' WHERE id=" . $row_update['id'] . " && colour='#3C0'");
mysql_close($update_result);
}
}
나는이 문제를 어떻게 해결할 수 있습니까?
PHP 5.3이 안정이와/ELSEIF 블록의 경우. –
@cillosis Zend Optimizer에서 지원하지 않기 때문에 서버 관리자는 PHP 5.3으로 업그레이드 할 수 없습니다. – methuselah