2014-10-10 2 views
0

저는 WordPress의 현재 시간을 가져오고 싶습니다. 그러나 오류를 어떻게 수정해야합니까? 거기에 또 다른 방법은 WordPress의 현재 시간을 얻을 수 있습니까?, 나는 WordPress (+ GMT)와 함께 사용하는 시간과 사용자가 선택한 시간이 아닌 서버 시간을 원한다. Wordpress는 functions.php에 현재 시간 오류를 얻습니다.

이러한 당신은 require_once('/wp-includes/functions.php');을 포함 할 필요가 없습니다 오류

Notice: Use of undefined constant ABSPATH - assumed 'ABSPATH' in C:\xampp1\htdocs\wp\wp-includes\functions.php on line 8 

Notice: Use of undefined constant WPINC - assumed 'WPINC' in C:\xampp1\htdocs\wp\wp-includes\functions.php on line 8 

Warning: require(ABSPATHWPINC/option.php): failed to open stream: No such file or directory in C:\xampp1\htdocs\wp\wp-includes\functions.php on line 8 

Fatal error: require(): Failed opening required 'ABSPATHWPINC/option.php' (include_path='.;C:\xampp1\php\PEAR') in C:\xampp1\htdocs\wp\wp-includes\functions.php on line 8 
+0

당신은 워드 프레스 내에서 코드를 사용하고 있습니까를 참조하십시오? 왜'wp-includes'에서'functions.php' 파일을 포함 시켰습니까? –

+0

date_i18n 함수가 functions.php에 있습니다. http://codex.wordpress.org/Function_Reference/current_time –

답변

1

있습니다 내 코드

<?php 

require_once('/wp-includes/functions.php'); 
$format = get_option('date_format') . ' ' . get_option('time_format'); 
print date_i18n($format, current_time('timestamp')); 

?> 

입니다. 바로이 들어 아래

<?php echo current_time('mysql', 1); ?> 

처럼 GMT 시간을 반환합니다 기능을 사용하여 더이 링크 http://codex.wordpress.org/Function_Reference/current_time

+0

치명적 오류 : 정의되지 않은 함수로 current_time()을 호출합니다 (C : \ xampp1 \ htdocs \ wp \ time.php 1 행). –

+0

@ Delta7 wp-includes/functions.php 파일을 포함 시켰습니까? –

관련 문제