【问题标题】:How can I call function into function into class?如何将函数调用到函数中?
【发布时间】:2017-10-29 14:19:28
【问题描述】:

我很想将函数调用到函数中,就像 laravel 与 oop php 的工作原理一样 示例:

App\Flight::where('active', 1)->orderBy('name', 'desc') ->take(10)->get();

这不可能吗?

【问题讨论】:

    标签: php fluent-interface


    【解决方案1】:

    您的类方法需要返回$this,这将允许您像这样链接调用。

    【讨论】:

      【解决方案2】:

      你可以使用 $this->functionName(); 调用

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-06-17
        • 2020-09-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多