If using php5.3 or higher,If php.ini is not configured correctly, a php date function error will occur.Many old PHP programming tutorials didn't mention this problem before,So many readers will feel confused,Below I will tell you three ways to solve this problem.
date () [function.date]:it is not safe to rely on the system "s timezone settings.
you are * required * to use the date.
timezone setting or the date_default_timezone_set () function.
in case you used any of those methods and you are still getting this warning,
you most likely misspelled the timezone identifier.
we selected "utc" for "8.0/no dst" instead in "
In fact, from php 5.1.0, when using functions like date (),If timezone is set incorrectly,Every time the time function is called,E_notice or e_warning information will be generated. And in PHP 5.1.0, the date.timezone option,It is off by default,No matter what php command you use is Greenwich Mean Time,But it seems that if php 5.3 is not set, this error will be forcibly thrown.Solve this problem,Just localize it.
One,Use date_default_timezone_set () in the header to set date_default_timezone_set ("prc");//Eastern time zone echo
date ("y-m-d h:i:s");
two,Use ini_set ("date.timezone", "asia/shanghai") in the header;
three,Modify php.ini (If it is a windows system, the file is in the C drive and the windows directory, if the system is installed in the C drive). Use Notepad to open php.ini to find date.timezone. Remove the semicolon and modify it to:date.timezone=prc
Restart the http service (such as apache2 or iis, etc.)!
You can choose any one of the above three methods.We recommend the third method,No need to add extra code every time.
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory