2012-02-14 97 views
0

下面的代碼,我在我的腳本中使用用於獲取日期日期錯誤升級

<?php echo date("Y-m-d", strtotime("tommorow")); ?> 

<?php $tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("Y")); echo "".date("Y-m-d", $tomorrow); ?> 

現在我得到的錯誤在PHP 5

It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone 

回答

3

只需設置你的時區在你的腳本的頂部,例如,倫敦:

date_default_timezone_set("Europe/London"); 
1

PHP 5.1做了一些改動mktime函數,如果未設置時區,它將引發錯誤。你可以在這裏閱讀文檔吧:http://php.net/manual/en/function.mktime.php

+0

<?php //設置要使用的默認時區。提供自PHP 5.1 date_default_timezone_set('GMT'); ?>工作感謝 – meandme 2012-02-14 08:56:30