cevincheung
V2EX  ›  PHP

看 Blade 源码看到这样的语法,这是语法糖么?

  •  
  •   cevincheung · Apr 28, 2016 · 2896 views
    This topic created in 3676 days ago, the information mentioned may be changed or developed.
        /**
         * Allow all the methods of BladeInstance to be called.
         *
         * @param string $name The name of the method to run
         * @param array $arguments The parameters to pass to the method
         *
         * @return mixed
         */
        public static function __callStatic($name, array $arguments)
        {
            return static::getInstance()->$name(...$arguments);
        }
    
    2 replies    2016-05-03 16:03:22 +08:00
    RryLee
        2
    RryLee  
       May 3, 2016
    laravel 中大量的使用 __call 和 __callStatic 的两个魔术方法 `...` 操作是 5.6 之后新填的特性,和其他语言一样,很酷的特性
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2422 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 00:35 · PVG 08:35 · LAX 17:35 · JFK 20:35
    ♥ Do have faith in what you're doing.