zoukankan      html  css  js  c++  java
  • PHP的time函数返回时间不正确

    PHP的time()得到的时间与当前时间相差很多,检查了PHP.ini,发现是时区不对。在PHP.ini中,当前设置为:

    [Date]
    ; Defines the default timezone used by the date functions
    ; http://php.net/date.timezone
    date.timezone = Europe/Paris

    ; http://php.net/date.default-latitude
    date.default_latitude = 48.88778

    ; http://php.net/date.default-longitude
    date.default_longitude = 2.31806

    也就是当前使用欧洲巴黎时间,现在我们把它修改为上海时间

    [Date]
    ; Defines the default timezone used by the date functions
    ; http://php.net/date.timezone
    date.timezone = Asia/Shanghai

    ; http://php.net/date.default-latitude
    date.default_latitude = 31.5167

    ; http://php.net/date.default-longitude
    date.default_longitude = 121.4500

    修改后保存PHP.ini,然后重启服务即可

  • 相关阅读:
    Javascript中String()和new String()的区别——JS的包装对象
    文言色彩的客套话之感想
    面试时候可以问的问题集锦
    ES6的原始类型数据——Symbol
    python
    python
    python
    python
    python
    python
  • 原文地址:https://www.cnblogs.com/little-mat/p/4562537.html
Copyright © 2011-2022 走看看