Home  >  Article  >  Backend Development  >  看不懂这个语法了,该如何解决

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

WBOY
WBOYOriginal
2016-06-13 12:26:31820browse

看不懂这个语法了

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


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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP顶用GD绘制饼图Next article:thinkphp,该如何处理