php ci method to set the time zone: first find and open the "conifg/config.php" file; then add the code "date_default_timezone_set('Asia/ShangHai');" in the file.
The operating environment of this article: windows7 system, CodeIgniter version 4.0, DELL G3 computer
Because the default time zone of CI is not China, the system time is obtained time, which is about 8 hours less than the normal time, so we need to set the time zone ourselves. Setting the time zone for the CI framework is very simple, just add the following code at the end of the "conifg/config.php" file:
/* 设置系统时区 */ date_default_timezone_set(‘Asia/ShangHai’); $config[‘time_zone’] = date_default_timezone_get();
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to set time zone in php ci. For more information, please follow other related articles on the PHP Chinese website!