当前位置:Gxlcms > PHP教程 > 看不懂这个语法了,该如何解决

看不懂这个语法了,该如何解决

时间:2021-07-01 10:21:17 帮助过:5人阅读

看不懂这个语法了

/**
* Get a Carbon instance for the current date and time
*
* @param DateTimeZone|string $tz
*
* @return static
*/
public static function now($tz = null)
{
return new static(null, $tz);
}


这个是Carbon类里返回当前时间的方法,想问直接return一个static是啥用法。实际发生了什么呢。
------解决思路----------------------
后期静态绑定 http://php.com/manual/zh/language.oop5.late-static-bindings.php
------解决思路----------------------
你看到的只是這個函數的參數和返回值,實際處理方法被隱藏了

人气教程排行