Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of failure to call time in php

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to solve the problem of failure to call time in php". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the problem of failure to call time in php".

The reason for the failure of calling time in php is that the time zone is not set correctly. The solution is: 1, set the time zone timezone in php.ini to "China Asia/Shanghai"; 2, compensate the timestamp value according to the time difference in the application.

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

What if I fail to call time in php?

The current number of hours obtained by using time in php is incorrect.

Solution:

It is usually the time zone timezone setting in php.ini that is not set to China Asia/Shanghai that causes the time difference.

It is normal after setting.

In the application, the timestamp value can also be compensated according to the time difference, for example, the display time is 8 hours slower.

Echo date ("m, d, Y, GI", time () + 80003600)

Is equivalent to the manual implementation of the time zone system.

Thank you for reading, the above is the content of "how to solve the problem of failure to call time in php". After the study of this article, I believe you have a deeper understanding of how to solve the problem of failure to call time in php, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report