码迷,mamicode.com
首页 > Web开发 > 详细

PHP strftime()函数输出乱码问题

时间:2017-02-23 18:48:39      阅读:487      评论:0      收藏:0      [点我收藏+]

标签:cal   显示   oca   time()   解释   str   系统时间   utf-8   nbsp   

直接调用strftime()
strftime(time_buf, 80, "%a, %e %b %G %T %z", p_stime);
 输出为 
??, 18 12?? 2015 11ê±19·?36?? +0800
原因

strftime()输出时是按照系统设置的编码格式输出的,和系统不匹配,
两个解决办法:
一、需要设置显示这些文字的工具使用 GBK 编码来解释该输出。
二、调用strftime前,把系统时间设置成想要的编码格式,例如setlocale(LC_TIME, ‘en_US.UTF-8‘)

PHP strftime()函数输出乱码问题

标签:cal   显示   oca   time()   解释   str   系统时间   utf-8   nbsp   

原文地址:http://www.cnblogs.com/linghangedu/p/6434721.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!