一、

时间不对是因为没设置时区

在xampp/php/php.ini中ctrl + f 查找date.timezone

该行默认注释,去掉 ; 修改为 date.timezone = PRC

php中date('Y/m/d',time())显示不对

 

 

 

php中date('Y/m/d',time())显示不对

上述方法不成功,通过在使用日期的PHP文件在页首添加date_default_timezone_set("PRC")函数设置

date_default_timezone_set("PRC");

echo date("Y-m-d H-i", time() );

相关文章:

  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
  • 2021-08-01
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-28
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
相关资源
相似解决方案