During project development, we often encounter a difference of 8 hours between the obtained time and the actual time, because our time zone range is different from that of the PHP developer, the default value is not UTC + 8. There are two general solutions: 1. open the PHP configuration file php. I... SyntaxHighlighter. all ();
During project development, we often encounter a difference of 8 hours between the obtained time and the actual time, because our time zone range is different from that of the PHP developer, the default value is not UTC + 8. There are two solutions:
1. open the PHP configuration file. ini file, search for the date in the file. timezone: remove the annotator ";" from the front and add the "RPC" character at the end of the row. if the date cannot be found in the file. timezone, you can manually add it at any location. the modified date. timezone configuration:
Date. timezone = "RPC" 2. Sometimes developers cannot obtain the permission to operate the php. ini file. this method is required. Generally, if a project has a configuration file or an entry file, you can use date_default_timezone_set () to modify the time zone. For example:
Date_default_timezone_set ("Asia/Chongqing"); available values in mainland China: Asia/Chongqing, Asia/Shanghai, Asia/Urumqi (in the order of Chongqing, Shanghai, and Urumqi ), hong Kong and Taiwan regions are available: Asia/Macao, Asia/Hong_Kong, Asia/Taipei (in the order of Macao, Hong Kong, and Taipei ).
This article is from the "FrancisRan" blog