本文章来介绍PHP date()与time()获取时间与本地时间不一致解决办法,有需要的可参考参考解决办法
在程序中加入
在页头使用
代码如下 | 复制代码 |
date_default_timezone_set()设置我的默认时区为北京时间 第一种解决方法: |
在程序中设置默认时区。
代码如下 | 复制代码 |
date_default_timezone_set('PRC'); //设置本地时区 |
第二种解决方法:
修改php.ini,将“date.timezone”项修改为“date.timezone = PRC”
大陆内地可用的值是:Asia/Chongqing ,Asia/Shanghai ,Asia/Urumqi (依次为重庆,上海,乌鲁木齐)
港台地区可用:Asia/Macao ,Asia/Hong_Kong ,Asia/Taipei (依次为澳门,香港,台北)
还有新加坡:Asia/Singapore
其他可用的值是:Etc/GMT-8 ,Singapore ,Hongkong ,PRC
注:PRC是中华人民共和国

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
