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 time error obtained by php time function

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

Share

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

Today, I will talk to you about how to solve the problem of getting time errors in the php time function, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Php time function to get the time error solutions: 1, set the default time zone to be used; 2, open php.ini to find "date.timezone" and remove the previous semicolon; 3, add the initialization statement of time in the program.

This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer

How to solve the problem of time error obtained by php time function?

The solution to the error of using date function to get the current time in php

If you are new to PHP to do a website, if you want to get the current time on the page, anyone who has studied programming knows to use the time function date (). First, use this function to format a local time / date, and write a test code first. As a result, the output time is 8 hours less than the actual time. What is the reason for this:

The code is as follows:

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