【发布时间】:2008-11-25 06:49:15
【问题描述】:
听起来很简单,但我在文档中找不到这个内置类和其他类的位置。我使用函数,但想知道 OO 方面有什么。
【问题讨论】:
听起来很简单,但我在文档中找不到这个内置类和其他类的位置。我使用函数,但想知道 OO 方面有什么。
【问题讨论】:
它不是 URL 或任何东西,但您可以使用反射获得一个公平的想法:
Reflection::export(new ReflectionClass('DateTime'));
Class [ class DateTime ] {
- Constants [11] {
Constant [ string ATOM ] { Y-m-d\TH:i:sP }
Constant [ string COOKIE ] { l, d-M-y H:i:s T }
Constant [ string ISO8601 ] { Y-m-d\TH:i:sO }
Constant [ string RFC822 ] { D, d M y H:i:s O }
Constant [ string RFC850 ] { l, d-M-y H:i:s T }
Constant [ string RFC1036 ] { D, d M y H:i:s O }
Constant [ string RFC1123 ] { D, d M Y H:i:s O }
Constant [ string RFC2822 ] { D, d M Y H:i:s O }
Constant [ string RFC3339 ] { Y-m-d\TH:i:sP }
Constant [ string RSS ] { D, d M Y H:i:s O }
Constant [ string W3C ] { Y-m-d\TH:i:sP }
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [9] {
Method [ public method __construct ] {
}
Method [ public method format ] {
}
Method [ public method modify ] {
}
Method [ public method getTimezone ] {
}
Method [ public method setTimezone ] {
}
Method [ public method getOffset ] {
}
Method [ public method setTime ] {
}
Method [ public method setDate ] {
}
Method [ public method setISODate ] {
}
}
}
不完美,因为没有论据,但至少是一个起点。他们应该让这更容易被发现,我同意!
【讨论】:
http://no2.php.net/date_create
构造函数信息。一些关于 cmets 序列化的好信息。
http://laughingmeme.org/2007/02/27/ 不错的教程,可能有点老了。
http://ditio.net/2008/06/03/php-datetime-and-datetimezone-tutorial/ 另一个略有不同的方法教程。
【讨论】:
您提到的 URL http://www.php.net/manual/en/migration52.classes.php 根本没有描述该类。当然,在某个地方记录了此类和其他类。
【讨论】:
这里有一个 PHP 5.2.0 中的新类列表:
http://www.php.net/manual/en/migration52.classes.php
..这里链接到新的 DateTime 类信息:
【讨论】:
可以在文档的 cmets 中找到描述:
http://php.net/manual/fr/book.datetime.php#84699
编辑:今天早上我发现了一些有趣的东西:
http://laughingmeme.org/2007/02/27/looking-at-php5s-datetime-and-datetimezone/
【讨论】:
可以在 php.net/DateTime 找到 DateTime 类文档,其中包含有关类和函数的信息,或者仅在 php.net/manual/en/class.datetime.php 中提供类文档
【讨论】:
这些东西记录在文档中 - 也许不是你要求的时候。
无论如何,通过扩展的作者,您可以阅读以获取完整的详细信息:http://derickrethans.nl/phparchitects-guide-to-date-and-time-programming.html
旁边是 Derick Rethans 就该主题到处发表演讲,并提供幻灯片。如果您有机会参加会议并聆听他的演讲,那就去做吧。
最近的一个:
FrOsCon,2010 年 8 月 22 日:xxxx://derickrethans.nl/talks/time-froscon10.pdf(来源:xxxx://derickrethans.nl/talks.html)
【讨论】: