Home > Article > Backend Development > Solution to the time error obtained by PHP's date() function in the xampp integrated environment
This article mainly talks about the solution when the date() function obtains the wrong time. Friends who have the same problem can learn from it.
Date() gets the time error
Specific method:
1. Open php.ini
2. Search timezone
3. Change to PRC
4. Enter key
5. Change to PRC
6. Complete
I didn’t expect that such a small problem is also a big pitfall. I searched online for a long time and basically said that I need to modify this
But after I opened it, I found that the default time zone was already configured
I used this function after twists and turns
echo date_default_timezone_get();
I found that the default time zone is Europe/Berlin
Based on this keyword, I found a detailed graphic explanation of the PHP time zone settings in the xampp integrated environment
I found that there is another setting below
Changed to In this way, then restart Apache and it will run correctly
Related tutorials:PHP video tutorial
The above is the detailed content of Solution to the time error obtained by PHP's date() function in the xampp integrated environment. For more information, please follow other related articles on the PHP Chinese website!