2010-05-21

symfony1.4 DateTime对于PHP低版本的兼容问题

类归于: symfony — 标签:, szn000 @ 13:17

在symfony1.4中使用DateTime 类 但是该类出现于 PHP 5.2.0以后 所以在使用(部分方法需要在PHP5.3.0以后版本才能使用)PHP5.2.0以前版本的服务器上 调用symfony调用该函数会出错 为了解决该类问题根据 PHP5.2.0 的DateTime类 写了俩个类 用以在低版本中使用该类
以重写方法
DateTime.class.php
__construct ([ string $time = "now" [, DateTimeZone $timezone = NULL ]] )
string format ( string $format )
int getOffset ( void )
int getTimestamp ( void )
DateTimeZone getTimezone ( void )
DateTime setDate ( int $year , int $month , int $day )
DateTime setISODate ( int $year , int $week [, int $day = 1 ] )
DateTime setTime ( int $hour , int $minute [, int $second = 0 ] )
DateTime setTimestamp ( int $unixtimestamp )
DateTime setTimezone ( DateTimeZone $timezone )
DateTime __wakeup ( void )

DateTimeZone.class.php
__construct ( string $timezone )
string getName ( void )
int getOffset ( DateTime $datetime )

文件下载地址: 下载点击我
附件使用时把类名中的My删除

评论暂缺 »

还没有任何评论。

这篇文章上的评论 RSS feed TrackBack URL

留下评论

WordPress 所驱动