V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cevincheung
V2EX  ›  PHP

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

  •  
  •   cevincheung · 2016-04-28 17:41:00 +08:00 · 2039 次点击
    这是一个创建于 2913 天前的主题,其中的信息可能已经有所发展或是发生改变。
        /**
         * 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 条回复    2016-05-03 16:03:22 +08:00
    RryLee
        2
    RryLee  
       2016-05-03 16:03:22 +08:00
    laravel 中大量的使用 __call 和 __callStatic 的两个魔术方法 `...` 操作是 5.6 之后新填的特性,和其他语言一样,很酷的特性
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2876 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:29 · PVG 17:29 · LAX 02:29 · JFK 05:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.