问题描述
我正在使用 XAMPP - PHP 和 MYSQL 服务器.当我尝试使用以下 -
I am using XAMPP - PHP and MYSQL servers. When I tried to use following -
getRates(date('Y-m-d'));
function getRates($cDate)
{
$query = "SELECT * FROM randa WHERE date like '$cDate'" //it only worked at times.
}
?>
然后我意识到 date('Y-m-d') 没有返回正确的日期.转到 php.ini 并更改时区.并且仍然返回错误的日期.
Then I realized the date('Y-m-d') does not return the correct date. Went to php.ini and changed time zone. And is still returning the wrong date.
我该如何解决这个问题?谢谢你
How can I fix this ? Thank you
推荐答案
试试这个
1) 在 httpd.conf (xamppapacheconfhttpd.conf) 中,添加以下行:
1) In httpd.conf (xamppapacheconfhttpd.conf) , add the following line:
SetEnv TZ Europe/Moscow
2) 在 [Date] 部分编辑 php.ini (xamppphpphp.ini) date.timezone 值:
2) Edit php.ini (xamppphpphp.ini) date.timezone value in [Date] section:
date.timezone = "Europe/Moscow"
3) 在 my.ini (xamppmysqlinmy.ini) 中添加或替换
3) In my.ini (xamppmysqlinmy.ini) add or replace
default-time-zone = "Europe/Moscow"
重启 Apache 和 MySQL
Restart Apache and MySQL
这篇关于如何设置时区 xampp mysql 和 apache?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)