1、使用PHP的date函数获取时间之前,先将时区设置为北京时区

2、获取当前时间

<?php

date_default_timezone_set('PRC');
echo "当前时间为:".date('Y-m-d H:i:s');

?>