状况是用smarty version 2.6.5-dev格式的时间在线上服务器显示时间不对.
{$smarty.now|date_format:”%Y/%m/%d %H:%M”}
会显示成 5068/08/16 10:30
检查smarty/plugins/shared.make_timestamp.php
strtotime函数在不同版本下会有不同返回结果
$time = strtotime($string);
编写代码确认
code:
echo time();
echo '---';
var_dump(strtotime(time()));
?>
win php5.3.1
result:
1313465002—bool(false)
linux php5.2.14
result:
1313465026—int(96457670026)
“96457670026”?这个就是引起错误的原因.
修改下smarty/plugins/shared.make_timestamp.php
解决问题
if (is_numeric($string) && $string != -1)
return $string;
$time = strtotime($string);
if (is_numeric($time) && $time != -1)
return $time;
No Responses (yet)
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.