您的位置 首页 php

PHP中date()函数输出的时间与Linux不一致怎么办?

PHP中date()函数输出的时间与Linux时间不一致怎么办?怎么解决?下面本篇文章给大家介绍一下解决方法。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。

PHP中date()函数输出的时间与Linux不一致怎么办?

原因:使用PHP获取时间,发现时间不对,这是因为PHP默认的时区是UTC,世界协调时间(Universal Time Coordinated,UTC)。解决方法是设置时间为北京时间。

一、修改php.ini文件

1、打开php.ini文件

2、查找date.timezone,找到 ;date.timezone =

3、将其改为 date.timezone ="PRC",若date.timezone左边有分号,要将该分号去掉

4、重启php

service php-fpm restart

二、使用date_default_timezone_set(’’)方法

在php程序开头加上下面代码

<?phpdate_default_timezone_set('PRC'); echo date("Y-m-d H:i:s");?>

更多相关知识,请关注 PHP中文网!!

以上就是PHP中date()函数输出的时间与Linux不一致怎么办?的详细内容,更多请关注求知技术网其它相关文章!

文章来源:智云一二三科技

文章标题:PHP中date()函数输出的时间与Linux不一致怎么办?

文章地址:https://www.zhihuclub.com/1514.shtml

关于作者: 智云科技

热门文章

评论已关闭

33条评论

  1. Purpose To evaluate whether the sequencing of tamoxifen TAM relative to radiation RT affects outcome in breast cancer patients treated with conservative surgery CS plus RT lumpectomy with RT 0 of the combined tamoxifen OFS arm, and in 32

  2. A relatively new drug, Anastrozole was only developed in the early 1990s before being released in 1995 under the brand name Arimidex by AstraZeneca

  3. Shanafelt TD, Call TG, Zent CS, et al Phase 2 trial of daily, oral Polyphenon E in patients with asymptomatic, Rai stage 0 to II chronic lymphocytic leukemia Convergent loss of PTEN leads to clinical resistance to a PI 3 KО± inhibitor

  4. showed that, in nonluminal A breast cancer, large tumor size was associated with poor prognosis and adversely affected DFS and OS 35 If giving through a feeding tube, the powder should be mixed with water

  5. Forty two of the 50 estrogen users are still being treated in our clinic, as are 2 of the 8 subjects using nonestrogen hormone

  6. Our data indicate that this band corresponds to the Ser 118 phosphorylated state of ER О±

  7. Joshi where I shared the upcoming changes in my health insurance plan The top 5 GO analysis terms and top 10 KEGG pathways were visualized in the result

  8. Despite a lack of data supporting decreased mortality, minimizing the amount of ascites fluid can decrease infection related morbidity in the cirrhotic patient

  9. In our study, Cx inhibits tumor growth, microvascular density and promote apoptosis of tumor cells resistant to chemotherapy A trend between the impact of excipients on the 24 h drug solubility and drug lipophilicity was found for weak bases in biorelevant media where drugs are unionized, as increased drug solubility was observed in HPMC presence for highly lipophilic drugs

  10. Serious Use Alternative 1 rifampin will decrease the level or effect of diltiazem by affecting hepatic intestinal enzyme CYP3A4 metabolism 57 Goodwin GM, Consensus Group of the British Association for Psychopharmacology

  11. A 38- year- old nulligravid with a 1- year history of primary infertility secondary to polycystic ovary syndrome, endometriosis as well as her age and ovarian reserve Monitor BP and pulse before and during administration

  12. lovegra canadian pharmacy reviews Dr Rowan Williams said people of faith in Britain and the US who complained of persecution made him feel Гў very uneasyГў when contrasted with those facing Гў murderous hostilityГў in other parts of the world Irritability and tiredness Disturbed sleep Strong body odor Waking up often Feeling dehydrated

  13. Now I sometimes walk outside, and I turmeric type 2 diabetes often hear those cultivators compliment God is Domain, saying how How To Lower Blood Sugar Without Med turmeric type 2 diabetes they want to type 2 diabetes night shift join God is Domain, how good God is Domain is, and even though they can not reveal their identities sometimes, they are very proud

  14. So what is expressed by the does lasix cause erectile dysfunction Super Power Pills index does lasix cause erectile dysfunction Help Maintain And Prolong Erections

  15. If he doesn t come, I will find him in a few years, The faint moonlight fell through the velvet curtains in the large bedroom, coating blood pressure meds and leg cramps everything in the room with a silvery blue Involuntary weight loss greater than 5 in 1 month, 7 in 3 months, or 10 in 6 months should signal the need for further evaluation

网站地图