通过RESTapi获取数据时出现时区错误

时间:2016-05-17 15:48:55

标签: php api laravel

我在通过API获取数据时遇到以下错误。在调用中传递了两个参数。 1)序列号(我确信这工作正常) 2)时区 - 这个我无法破解应该给出的格式/值。

<html><head><title>Slim Application Error</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>Slim Application Error</h1><p>The application could not run because of the following error:</p><h2>Details</h2><div><strong>Type:</strong> ErrorException</div><div><strong>Code:</strong> 2</div><div><strong>Message:</strong> date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.</div><div><strong>File:</strong> /var/www/api/v1/index.php</div><div><strong>Line:</strong> 199</div><h2>Trace</h2><pre>#0 [internal function]: Slim\Slim::handleErrors(2, 'date_default_ti...', '/var/www/api/v1...', 199, Array)

1 /var/www/api/v1/index.php(199):date_default_timezone_get()

2 /var/www/api/v1/include/DbHandler.php(183):ConvertGMTToLocalTimezone(&#39; 2016-05-10 01:1 ...&#39;,&#39; sun。 util.calend ...&#39)

3 /var/www/api/v1/index.php(67):DbHandler-&gt; getArticle(&#39; 7000&#39;,&#39; sun.util.calend ...&#39 ;)

4 [内部函数]:{closure}()

5 /var/www/api/libs/Slim/Route.php(436):call_user_func_array(Object(Closure),Array)

6 /var/www/api/libs/Slim/Slim.php(1307):Slim \ Route-&gt; dispatch()

7 /var/www/api/libs/Slim/Middleware/Flash.php(85):Slim \ Slim-&gt; call()

8 /var/www/api/libs/Slim/Middleware/MethodOverride.php(92):Slim \ Middleware \ Flash-&gt; call()

9 /var/www/api/libs/Slim/Middleware/PrettyExceptions.php(67):Slim \ Middleware \ MethodOverride-&gt; call()

10 /var/www/api/libs/Slim/Slim.php(1254):Slim \ Middleware \ PrettyExceptions-&gt; call()

11 /var/www/api/v1/index.php(275):Slim \ Slim-&gt; run()

12 {main}

我应该在time_zone中传递什么值以获得200 Ok响应。

0 个答案:

没有答案