CarbonInterval {#1680 ▼
interval: + 00:07:36.0
#tzName: null
#localMonthsOverflow: null
#localYearsOverflow: null
#localStrictModeEnabled: null
#localHumanDiffOptions: null
#localToStringFormat: null
#localSerializer: null
#localMacros: null
#localGenericMacros: null
#localFormatFunction: null
#localTranslator: null
+"y": 0
+"m": 0
+"d": 0
+"h": 0
+"i": 0
+"s": 456
+"f": 0.0
+"weekday": 0
+"weekday_behavior": 0
+"first_last_day_of": 0
+"invert": 0
+"days": false
+"special_type": 0
+"special_amount": 0
+"have_weekday_relative": 0
+"have_special_relative": 0
}如何从这个CarbonPeriod对象访问这个interval: + 00:07:36.0值。
发布于 2019-10-30 20:52:07
CarbonInterval有一个名为cascade()的函数,它将相应地填充其他字段。
它将返回类似下面这样的carbonInterval对象。
+"y": 0
+"m": 0
+"d": 0
+"h": 0
+"i": 7
+"s": 36
+"f": 0.0然后,我们可以访问这些属性,也可以调用format('%H:%I:%s')来获取所需的值。
示例
$carbonInterval->cascade()->format('%H:%I:%s')https://stackoverflow.com/questions/58625382
复制相似问题