Home  >  Article  >  Backend Development  >  How to solve the problem of inaccurate PHP time?

How to solve the problem of inaccurate PHP time?

Guanhui
GuanhuiOriginal
2020-07-22 14:18:542100browse

How to solve the problem of inaccurate PHP time?

How to solve the problem of inaccurate PHP time?

1. Open the php.ini file, find ";date.timezone", delete the preceding semicolon, and change the value to RPC;

How to solve the problem of inaccurate PHP time?

2. Add "date_default_timezone_set(RPC)" at the beginning of the code, which means to set the current time zone.

date_default_timezone_set("RPC");

Recommended tutorial: "PHP"

The above is the detailed content of How to solve the problem of inaccurate PHP time?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn