Heim  >  Artikel  >  Backend-Entwicklung  >  看不懂这个语法了

看不懂这个语法了

WBOY
WBOYOriginal
2016-06-23 13:24:04749Durchsuche

    /**     * 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.net/manual/zh/language.oop5.late-static-bindings.php

你看到的只是??函?的??和返回值,???理方法被?藏了

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php入学者Nächster Artikel:php的lareval框架配置出错