Is there a difference between the two or are they equivalent? ?
黄舟2017-05-16 16:55:43
Carbon
是对时间
的一个封装。在内部通过使用DateTime
实现了很多简单的方法。
比如Carbon::now
来说,使用echo Carbon:now()->toRfc2822String()
可以直接获取到当前时间。使用DateTime
你可能会需要echo (new DateTime())->format('xxxxx')
Including other operations on time, increasing and decreasing days/seconds/minutes/months, time comparison, etc.
This question is equivalent to asking what is the difference between Laravel and PHP (perhaps a little inappropriate). Laravel has encapsulated modules and logical functions such as Route/Request/Http/Command, which can be developed quickly and safely. To develop using pure native PHP, you just need to design various things yourself.
習慣沉默2017-05-16 16:55:43
You will know soon after taking a look at the static method it encapsulates